System.Composition 命名空間

System.Composition 命名空間包含用於建立和指定匯出屬性、從組合擷取匯出、設定匯入屬性,以及指定組件在組合期間互動方式的類別。 The System.Composition namespace contains classes for creating and specifying export attributes, retrieving exports from a composition, configuring import attributes, and for specifying how parts interact during composition.

類別

CompositionContext

提供方法來擷取組合的匯出。Provides methods to retrieve exports from the composition.

CompositionContextExtensions

將方法加入至具類型組件模型專用的組合內容。Adds methods to the composition context that are specific to the typed parts model.

Export<T>

允許釋放與匯出執行個體相關聯之組件圖形的參考。A reference that allows the graph of parts associated with an exported instance to be released.

ExportAttribute

指定型別、屬性、欄位或方法可提供特定匯出。Specifies that a type, property, field, or method provides a particular export.

ExportFactory<T>

建立組件之新執行個體的 Factory,這個組件會提供指定的匯出。A factory that creates new instances of a part that provides the specified export.

ExportFactory<T,TMetadata>

建立組件之新執行個體的 Factory,這個組件透過附加的中繼資料提供指定的匯出。A factory that creates new instances of a part that provides the specified export, with attached metadata.

ExportMetadataAttribute

針對以 ExportAttribute 屬性 (Attribute) 標示的類型、屬性 (Property)、欄位或方法,指定中繼資料。Specifies metadata for a type, property, field, or method that is marked with the ExportAttribute attribute.

ImportAttribute

指定應該由裝載容器提供屬性、欄位或參數值。Specifies that a property, field, or parameter value should be provided by the host container.

ImportingConstructorAttribute

指定建立屬性化組件時應使用的建構函式。Specifies which constructor should be used when creating an attributed part.

ImportManyAttribute

指定屬性、欄位或參數應由裝載容器來填入所有相符的匯出。Specifies that a property, field, or parameter should be populated with all matching exports by the host container.

ImportMetadataConstraintAttribute

指定匯入必須有特定的中繼資料值。Specifies that an import requires certain metadata values.

MetadataAttributeAttribute

指定自訂屬性 (Attribute) 的屬性 (Property) 可針對套用至相同類型、屬性 (Property)、欄位或方法的匯出來提供中繼資料。Specifies that a custom attribute's properties provide metadata for exports applied to the same type, property, field, or method.

OnImportsSatisfiedAttribute

指定應在組合完成時呼叫的方法。Specifies that a method should be called when composition is completed.

PartMetadataAttribute

指定組件的中繼資料。Specifies metadata for a part.

PartNotDiscoverableAttribute

指定此類型的匯出將不會包含在目錄中。Specifies that this type's exports won't be included in a catalog.

SharedAttribute

將裝飾的組件標示為限制在指定界限內共用。Marks the decorated part as being constrained to sharing within the specified boundary.

SharingBoundaryAttribute

當套用至 ExportFactory<T> 物件的匯入時,標記共用範圍的界限。When applied to an import of an ExportFactory<T> object, marks the boundary of a sharing scope.