Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is AggregateCatalog?

Tags:

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)

like image 311
Louis Rhys Avatar asked Nov 22 '10 03:11

Louis Rhys


People also ask

What is Product Catalog example?

The best example of a product catalog is the Amazon marketplace, where you can get a host of information in a single click. Think about a book that you've been trying to buy - Amazon lists all the information that you need.

What is a B2B catalog?

B2B product catalogs contain important purchasing information such as product codes, names, descriptions, images, unique customer pricing, available quantities, minimum order quantities etc. and offer detailed views for customers to make quick and precise decisions.

What is a catalog in ecommerce?

What is an Ecommerce Catalog? An online catalog, also known as a digital catalog or B2B ecommerce catalog, is an extensive electronic catalog on a website that showcases all the products you sell and allows buyers to shop and purchase.


2 Answers

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.

like image 160
Den Delimarsky Avatar answered Sep 20 '22 16:09

Den Delimarsky


Mef has a small learning curve - go thru the docs at mef.codeplex.com atleast once. Or try screencasts if you're really pressed for time.

The idea is that a catalog is a dictionary of exported parts (objects to be injected) or parts that need imports (that need injected objects).. The catalog can be populated in multiple ways (hence the diff Catalog derivations) -- from a Directory (all asm in a dir) or a Specific assembly.

Next you can create a composite catalog e.g. you want to create a single dictionary that contains all exported objects from DirA and from this specific assembly lying in DirB. In this case, you can create individual catalogs and then a composite catalog which merges the two. Now you consume this merged dictionary in your code to ask for imports/exports.

like image 42
Gishu Avatar answered Sep 23 '22 16:09

Gishu