Why use MEF with Prism?

Topics: Prism v4 - Silverlight 4, Prism v4 - WPF 4
Aug 13, 2010 at 7:16 AM


I am pretty new with both MEF and Prism. What I know is (correct me if I am wrong), Prism sits on top of Unity for module discovery. MEF may not be a parallel technology to Unity but helps with IoC. As I saw in Prism Drop 4, there is a seperate Dll for MEF extensions. I wanted to know the benifits of using MEF extensions PRISM rather than using the regular PRISM? Are there any added benefits or is it going to give me performance improvements?



Aug 13, 2010 at 5:09 PM

Hi Abhay,

Nice to see that you started looking at Prism. First of all, it could be useful for you to know that Prism is agnostic of the users’ choice for using MEF, Unity or any other IoC in their applications. However, MEF and Unity are the recommended approaches by the product team.

Regarding to MEF, it has shipped in .NET 4 and Silverlight 4, and has been available as of Prism v4. Also it is used in Visual Studio 2010 as its platform for extensibility.

MEF was created to simplify the design of extensible applications and components. When using MEF you could find that it is easy to understand as well as to make your application easy to extend. Compared to Unity, it is more than a plain lightweight dependency injection (DI) container, since it has some aspects of IoC, but it is not a general purpose DI container. For more information about MEF you could take a look at the following links:

As for the performance there is no official comparison between these two technologies. Nevertheless, you could check the following links related to this topic:

Please let me know if this helps.

Fernando Antivero