Is MEF compatible with the article "WPF Hands-On Lab: Get Started with the Prism Library" ?

Topics: Prism v4 - WPF 4
May 19, 2013 at 11:48 AM
Edited May 19, 2013 at 11:56 AM
Follow the instruction in http://msdn.microsoft.com/en-us/library/ff921141%28v=pandp.40%29.aspx, I create a WPF application.

Every thing was OK as the article said.

The article said: "This hands-on lab uses the Unity container, but you can also use the Managed Extensibility Framework (MEF) with the Prism Library."

Now I want to use MEF instead of Unity. So I
  1. added
    reference to Microsoft.Practices.Prism.MefExtensions
  2. added
    using Microsoft.Practices.Prism.MefExtensions;
  3. modify
    class Bootstrapper:UnityBootstrapper
    to
    class Bootstrapper:MefBootstrapper
Then I got the ModuleTypeLoaderNotFoundException with message:
"There is currently no moduleTypeLoader in the ModuleManager that can retrieve the specified module."

How to fix it ?
May 20, 2013 at 4:37 PM
Hi,

Since Unity and MEF work different, you will need to do some modifications to the code, i.e. the way you declare Modules, so that your application can work with MEF. Changing the references is just the first step. To understand how you can make those changes, you can always check Prism documentation, since each of the documentation sections describes how to implement the same code with both Unity and MEF containers:

Regards,

Federico Martinez
http://blogs.southworks.net/fmartinez
May 21, 2013 at 5:06 AM
Federico,

Thanks, now I know that the answer is in the following two link.

3: Managing Dependencies Between Components
http://msdn.microsoft.com/en-us/library/ff921140%28v=pandp.40%29.aspx
4: Modular Application Development
http://msdn.microsoft.com/en-us/library/gg405479%28v=pandp.40%29.aspx

Hon-Jang