About a month ago I posted some ideas around MEF and Prism together. As part of the post, I presented 2 high-level scenarios for MEF/Prism integration (and there are likely more)

  • Use Prism with MEF as an add-on for extensibility. That is make modules extensible through MEF.  You can think of this as the “Two worlds in harmony” solution. Your core architecture rests on Prism's modularity / and an IoC Container and sits side by side with MEF.
  • Use MEF primarily for modularity, and pull in Prism bits for UI composition.  In this model, your core architecutre sits on top of MEF, with MEF replacing the services of your IoC.

    Recently Jeremy Likeness of Wintillect started exploring the first approach. He’s started a series of blog posts on his explorations down that path. If you check the series you’ll see how he is introducing a new type of module called a PartModule that then uses MEF. The approach he takes is nice because it uses all of the existing Prism module loading infrastructure including Unity, and then adds on that when the module is received, it is registered through MEF. He also leverages MEF’s recomposition capabilities such that when new things are received, they automatically show up as recomposable parts are recomposed.

    Jeremy has 3 posts in the series so far, the content is nice and it includes all the code.

  • PRISM, MEF, and MVVM Part 1 of 3: Unity Glue
  • PRISM, MEF, and MVVM Part 2 of 3: Making PRISM MEF Friendly
  • PRISM, MEF, and MVVM Part 3 of 3: Dynamic MEF Modules in PRISM

    This is just one of what I am sure will be many explorations to come!