Search code examples
c#.netmefcatalogsystem.componentmodel

What is AggregateCatalog?


What is AggregateCatalog? What does it mean when you construct a new AggregateCatalog()? What does it mean when you add assemblies to the catalog, eg catalog.Catalogs.Add(new AssemblyCatalog(someAssembly))? Other than assemblies what can you add to the catalog? any general knowledge related to this would be helpful, too (I'm a total noob)


Solution

  • AggregateCatalog in MEF basically allows you to collect multiple extension catalogs. When you call new AggregateCatalog(), you are basically instantiating a new catalog collection (not necessarily populated) that can contain multiple instances of ComposablePartCatalog, which can contain multiple parts.

    Consider it a class that helps you collect parts from multiple sets.

    Assemblies are just a way to push parts to the calling application. You can pass parts directly from inside the existing assembly.

    For more information about catalogs, I would recommend reading this.