Table of Contents

Class ComposablePartDefinition

Namespace
Microsoft.VisualStudio.Composition
Assembly
Microsoft.VisualStudio.Composition.dll
public class ComposablePartDefinition : IEquatable<ComposablePartDefinition>
Inheritance
ComposablePartDefinition
Implements
Inherited Members

Constructors

ComposablePartDefinition(TypeRef, IReadOnlyDictionary<string, object?>, IReadOnlyCollection<ExportDefinition>, IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>, IEnumerable<ImportDefinitionBinding>, string?, IReadOnlyList<MethodRef>, MethodRef?, IReadOnlyList<ImportDefinitionBinding>?, CreationPolicy)

Initializes a new instance of the ComposablePartDefinition class.

public ComposablePartDefinition(TypeRef partType, IReadOnlyDictionary<string, object?> metadata, IReadOnlyCollection<ExportDefinition> exportedTypes, IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>> exportingMembers, IEnumerable<ImportDefinitionBinding> importingMembers, string? sharingBoundary, IReadOnlyList<MethodRef> onImportsSatisfiedMethods, MethodRef? importingConstructorRef, IReadOnlyList<ImportDefinitionBinding>? importingConstructorImports, CreationPolicy partCreationPolicy)

Parameters

partType TypeRef

Type of the part.

metadata IReadOnlyDictionary<string, object>

The metadata discovered on the part.

exportedTypes IReadOnlyCollection<ExportDefinition>

The exported types.

exportingMembers IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>

The exporting members.

importingMembers IEnumerable<ImportDefinitionBinding>

The importing members.

sharingBoundary string

The sharing boundary that this part is shared within.

onImportsSatisfiedMethods IReadOnlyList<MethodRef>

The method to invoke after satisfying imports, if any.

importingConstructorRef MethodRef

The constructor to invoke to construct the part.

importingConstructorImports IReadOnlyList<ImportDefinitionBinding>

The importing arguments taken by the importing constructor. null if the part cannot be instantiated.

partCreationPolicy CreationPolicy

The creation policy for this part.

ComposablePartDefinition(TypeRef, IReadOnlyDictionary<string, object?>, IReadOnlyCollection<ExportDefinition>, IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>, IEnumerable<ImportDefinitionBinding>, string?, IReadOnlyList<MethodRef>, MethodRef?, IReadOnlyList<ImportDefinitionBinding>?, CreationPolicy, bool)

Initializes a new instance of the ComposablePartDefinition class.

public ComposablePartDefinition(TypeRef partType, IReadOnlyDictionary<string, object?> metadata, IReadOnlyCollection<ExportDefinition> exportedTypes, IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>> exportingMembers, IEnumerable<ImportDefinitionBinding> importingMembers, string? sharingBoundary, IReadOnlyList<MethodRef> onImportsSatisfiedMethods, MethodRef? importingConstructorRef, IReadOnlyList<ImportDefinitionBinding>? importingConstructorImports, CreationPolicy partCreationPolicy, bool isSharingBoundaryInferred)

Parameters

partType TypeRef

Type of the part.

metadata IReadOnlyDictionary<string, object>

The metadata discovered on the part.

exportedTypes IReadOnlyCollection<ExportDefinition>

The exported types.

exportingMembers IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>

The exporting members.

importingMembers IEnumerable<ImportDefinitionBinding>

The importing members.

sharingBoundary string

The sharing boundary that this part is shared within.

onImportsSatisfiedMethods IReadOnlyList<MethodRef>

The method to invoke after satisfying imports, if any.

importingConstructorRef MethodRef

The constructor to invoke to construct the part.

importingConstructorImports IReadOnlyList<ImportDefinitionBinding>

The importing arguments taken by the importing constructor. null if the part cannot be instantiated.

partCreationPolicy CreationPolicy

The creation policy for this part.

isSharingBoundaryInferred bool

A value indicating whether the part does not have an explicit sharing boundary, and therefore can obtain its sharing boundary based on its imports.

ComposablePartDefinition(TypeRef, IReadOnlyDictionary<string, object?>, IReadOnlyCollection<ExportDefinition>, IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>, IEnumerable<ImportDefinitionBinding>, string?, IReadOnlyList<MethodRef>, MethodRef?, IReadOnlyList<ImportDefinitionBinding>?, CreationPolicy, bool, IEnumerable<AssemblyName>)

Initializes a new instance of the ComposablePartDefinition class.

public ComposablePartDefinition(TypeRef partType, IReadOnlyDictionary<string, object?> metadata, IReadOnlyCollection<ExportDefinition> exportedTypes, IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>> exportingMembers, IEnumerable<ImportDefinitionBinding> importingMembers, string? sharingBoundary, IReadOnlyList<MethodRef> onImportsSatisfiedMethods, MethodRef? importingConstructorRef, IReadOnlyList<ImportDefinitionBinding>? importingConstructorImports, CreationPolicy partCreationPolicy, bool isSharingBoundaryInferred, IEnumerable<AssemblyName> extraInputAssemblies)

Parameters

partType TypeRef

Type of the part.

metadata IReadOnlyDictionary<string, object>

The metadata discovered on the part.

exportedTypes IReadOnlyCollection<ExportDefinition>

The exported types.

exportingMembers IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>

The exporting members.

importingMembers IEnumerable<ImportDefinitionBinding>

The importing members.

sharingBoundary string

The sharing boundary that this part is shared within.

onImportsSatisfiedMethods IReadOnlyList<MethodRef>

The method to invoke after satisfying imports, if any.

importingConstructorRef MethodRef

The constructor to invoke to construct the part.

importingConstructorImports IReadOnlyList<ImportDefinitionBinding>

The importing arguments taken by the importing constructor. null if the part cannot be instantiated.

partCreationPolicy CreationPolicy

The creation policy for this part.

isSharingBoundaryInferred bool

A value indicating whether the part does not have an explicit sharing boundary, and therefore can obtain its sharing boundary based on its imports.

extraInputAssemblies IEnumerable<AssemblyName>

A sequence of extra assemblies to be added to the set for GetInputAssemblies(ISet<AssemblyName>, Func<Assembly, AssemblyName>).

Properties

CreationPolicy

public CreationPolicy CreationPolicy { get; }

Property Value

CreationPolicy

ExportDefinitions

Gets a sequence of all exports found on this part (both the type directly and its members).

public IEnumerable<KeyValuePair<MemberRef?, ExportDefinition>> ExportDefinitions { get; }

Property Value

IEnumerable<KeyValuePair<MemberRef, ExportDefinition>>

ExportedTypes

Gets the types exported on the part itself.

public IReadOnlyCollection<ExportDefinition> ExportedTypes { get; }

Property Value

IReadOnlyCollection<ExportDefinition>

ExportingMembers

Gets the exports found on members of the part (exporting properties, fields, methods.)

public IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>> ExportingMembers { get; }

Property Value

IReadOnlyDictionary<MemberRef, IReadOnlyCollection<ExportDefinition>>

ExtraInputAssemblies

Gets the sequence of extra input assemblies that will be added to the input assemblies for this ComposablePartDefinition.

public IEnumerable<AssemblyName> ExtraInputAssemblies { get; }

Property Value

IEnumerable<AssemblyName>

Id

public string Id { get; }

Property Value

string

ImportingConstructorImports

Gets the list of parameters on the importing constructor, or null if the part cannot be instantiated.

public IReadOnlyList<ImportDefinitionBinding>? ImportingConstructorImports { get; }

Property Value

IReadOnlyList<ImportDefinitionBinding>

ImportingConstructorOrFactory

public MethodBase? ImportingConstructorOrFactory { get; }

Property Value

MethodBase

ImportingConstructorOrFactoryRef

public MethodRef? ImportingConstructorOrFactoryRef { get; }

Property Value

MethodRef

ImportingMembers

public ImmutableHashSet<ImportDefinitionBinding> ImportingMembers { get; }

Property Value

ImmutableHashSet<ImportDefinitionBinding>

Imports

Gets a sequence of all imports found on this part (both members and importing constructor).

public IEnumerable<ImportDefinitionBinding> Imports { get; }

Property Value

IEnumerable<ImportDefinitionBinding>

IsInstantiable

public bool IsInstantiable { get; }

Property Value

bool

IsShared

public bool IsShared { get; }

Property Value

bool

IsSharingBoundaryInferred

Gets a value indicating whether the sharing boundary must be inferred from what is imported.

public bool IsSharingBoundaryInferred { get; }

Property Value

bool

Remarks

This is true when the part was discovered by MEFv1 attributes, since these attributes do not have a way to convey a sharing boundary. This is false when the part is discovered by MEFv2 attributes, which have a SharedAttribute(string) that they can use to specify the value. When this is true, the SharingBoundary property is set to Empty.

Metadata

Gets the metadata for this part.

public IReadOnlyDictionary<string, object?> Metadata { get; }

Property Value

IReadOnlyDictionary<string, object>

Remarks

This metadata has no effect on composition, but may be useful if the host wishes to filter a catalog based on part metadata prior to creating a composition.

OnImportsSatisfiedMethodRefs

Gets the list of methods to invoke after imports are satisfied.

public IReadOnlyList<MethodRef> OnImportsSatisfiedMethodRefs { get; }

Property Value

IReadOnlyList<MethodRef>

OnImportsSatisfiedMethods

Gets the list of methods to invoke after imports are satisfied.

public IEnumerable<MethodInfo> OnImportsSatisfiedMethods { get; }

Property Value

IEnumerable<MethodInfo>

SharingBoundary

public string? SharingBoundary { get; }

Property Value

string

Type

public Type Type { get; }

Property Value

Type

TypeRef

public TypeRef TypeRef { get; }

Property Value

TypeRef

Methods

Equals(ComposablePartDefinition?)

public bool Equals(ComposablePartDefinition? other)

Parameters

other ComposablePartDefinition

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString(TextWriter)

public void ToString(TextWriter writer)

Parameters

writer TextWriter