This project has moved. For the latest updates, please go here.

Custom catalogs & "definitionOrigin"

Mar 27, 2010 at 5:17 AM

I'd like to create a custom catalog that is similar to AssemblyCatalog. Like AssemblyCatalog, my catalog will wrap an inner TypeCatalog. Looking at the MEF source, the pattern for catalogs that wrap other catalogs is to pass through an ICompositionElement definitionOrigin. Eventually, the definition origin gets passed into AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable by TypeCatalog. However, ICompositionElement definitionOrigin is passed to the inner catalogs via internal constructors on AssemblyCatalog, TypeCatalog, etc. Since these constructors are internal, I don't see how I can follow this pattern. What is the expectation when creating a custom catalog similar to AssemblyCatalog that wraps TypeCatalog? How can I correctly handle the ICompositionElement definitionOrigin?


Mar 27, 2010 at 5:15 PM
Edited Mar 27, 2010 at 5:16 PM

Hi Ryan

You don't actually need ICompositionElement to be passed in to wrap a catalog. If you check our Filtered Catalogs wiki page you will see an example of a decorating catalog that filters the underlying catalog based on metadata.