AssemblyCatalog Class
Discovers attributed parts in a managed code assembly.
System.ComponentModel.Composition.Primitives.ComposablePartCatalog
System.ComponentModel.Composition.Hosting.AssemblyCatalog
Namespace: System.ComponentModel.Composition.Hosting
Assembly: System.ComponentModel.Composition (in System.ComponentModel.Composition.dll)
The AssemblyCatalog type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | AssemblyCatalog(Assembly) | Initializes a new instance of the AssemblyCatalog class with the specified assembly. |
![]() | AssemblyCatalog(String) | Initializes a new instance of the AssemblyCatalog class with the specified code base. |
![]() | AssemblyCatalog(Assembly, ICompositionElement) | Initializes a new instance of the AssemblyCatalog class with the specified assembly. |
![]() | AssemblyCatalog(Assembly, ReflectionContext) | Initializes a new instance of the AssemblyCatalog class with the specified assembly and reflection context. |
![]() | AssemblyCatalog(String, ICompositionElement) | Initializes a new instance of the AssemblyCatalog class with the specified code base. |
![]() | AssemblyCatalog(String, ReflectionContext) | Initializes a new instance of the AssemblyCatalog class with the specified code base and reflection context. |
![]() | AssemblyCatalog(Assembly, ReflectionContext, ICompositionElement) | Initializes a new instance of the AssemblyCatalog class with the specified assembly and reflection context. |
![]() | AssemblyCatalog(String, ReflectionContext, ICompositionElement) | Initializes a new instance of the AssemblyCatalog class with the specified code base and reflection context. |
| Name | Description | |
|---|---|---|
![]() ![]() | Assembly | Gets the assembly whose attributed types are contained in the assembly catalog. |
![]() ![]() | Parts | Gets the part definitions that are contained in the catalog. (Inherited from ComposablePartCatalog.) In .NET Framework Client Profile, this member is overridden by Parts. In Portable Class Library, this member is overridden by Parts. |
| Name | Description | |
|---|---|---|
![]() ![]() | Dispose() | Releases all resources used by the ComposablePartCatalog. (Inherited from ComposablePartCatalog.) |
![]() ![]() | Dispose(Boolean) | Releases the unmanaged resources used by the AssemblyCatalog and optionally releases the managed resources. (Overrides ComposablePartCatalog.Dispose(Boolean).) |
![]() ![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetEnumerator | Returns an enumerator that iterates through the catalog. (Overrides ComposablePartCatalog.GetEnumerator().) |
![]() ![]() | GetExports | Gets a collection of exports that match the conditions specified by the import definition. (Overrides ComposablePartCatalog.GetExports(ImportDefinition).) |
![]() ![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() ![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | ToString | Gets a string representation of the assembly catalog. (Overrides Object.ToString().) |
| Name | Description | |
|---|---|---|
![]() | CreateCompositionService | Creates a new composition service by using the specified catalog as a source for exports. (Defined by CatalogExtensions.) |
![]() | Filter | Filters the specified catalog with the specified filter function. (Defined by ScopingExtensions.) |
| Name | Description | |
|---|---|---|
![]() ![]() ![]() | ICompositionElement.DisplayName | Gets the display name of the AssemblyCatalog object. |
![]() ![]() ![]() | ICompositionElement.Origin | Gets the composition element that this element originated from. |
![]() ![]() | IEnumerable.GetEnumerator | Returns an enumerator that iterates through the catalog. (Inherited from ComposablePartCatalog.) |
The following code demonstrates the common scenario of an application creating an AssemblyCatalog to parse its own assembly. This is a straightforward way to load parts contained in a single project into the Managed Extensibility Framework (MEF).
[Export] class MyAddin { public String myData { get { return "The data!"; } } } class MyProgram { [Import] public MyAddin myAddin { get; set; } } class Program { static void Main(string[] args) { AggregateCatalog catalog = new AggregateCatalog(); catalog.Catalogs.Add(new AssemblyCatalog(typeof(MyAddin).Assembly)); CompositionContainer _container = new CompositionContainer(catalog); MyProgram myProgram = new MyProgram(); _container.SatisfyImportsOnce(myProgram); Console.WriteLine(myProgram.myAddin.myData); Console.ReadLine(); _container.Dispose(); } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.


