This project has moved and is read-only. For the latest updates, please go here.

Imports - Mef - Prism

Mar 29, 2011 at 2:17 AM

I am pretty new to MEF and PRISM, so my apologizes if this question has been answered before.

I have been having a difficult time with understanding how MEF satisfies imports. I created a project that uses the Prism and the MEF Bootstrapper. The project is a WPF project. As I started to implement the MEF import/export structure, I was running into issues where some of my imports were never satisfied.  I tried to follow the documentation and found some examples, however a lot of the examples focused on Silverlight and some methods that are not present for use in a non silverlight project.  Anyway, I created a project that demonstrates the issue, link is below.

The short version of my question, what do you have to do to allow MEF to correctly handle Imports and Exports..?

protected override void ConfigureAggregateCatalog()

            // I assumed that adding the modues to the AggregateCatalog would result in getting the import satsified,
            // as this does not seem to happen, I am not sure where to go?
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));
            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Module1.Module1Mod).Assembly));


The above is one part of the main prism bootstrapper class that adds the required assemblies to the catalog. After looking at this for a while, I am not sure what else is required?

Example Project:


Thanks for any feedback.