MEF for Beginner (Catalogs) – part 10
this post will focus on Catalogs.
What is MEF Catalogs?
MEF container is using catalogs as its search area definition.
the catalog have instructions about where can MEF look for
the compose-able parts (import and export definitions).
in short catalogs are actually a discovery instruction.
Out of the box catalogs
MEF is shipping with the following out of the box catalogs:
- TypeCatalog (line 1) define that specific types should includes in the discovery process.
- DirectoryCatalog (line 2) instruct the discovery process to search for compose-able pars
within specific assembly.
- DirectoryCatalog (line 3) is the most common used catalog, which instruct MEF to
search for compose-able parts within assemblies under specific directory using search pattern ("*.dll").
- AggregateCatalog (line 4) is aggregation of different catalogs instances.
this catalog enable to add and remove catalogs at runtime.
Silverlight (CTP 9) introduce new catalog named DeploymentCatalog which should replace the PackageCatalog.
my next post will discuss more on this topic (soon).
Silverlight is adding the PackageCatalog which is searching within assemblies which include in the package. the following snippet demonstrate the Silverlight PackageCatalog: as you can see the PackageCatalog can include multiple packages.
The catalogs use to define the search boundary of the composition container discovery process.
different catalogs can be use for different boundary ranges.
each of the previous parts of this series contains samples which is using catalogs
you can explore the previous parts from the TOC.