Now to the question, what is the story on Prism and MEF? I am getting asked this now several times a day, more so than the IoC question.
I am happy to say we’re working with p&p to come up with a good answer.
Note: This is still a work-in-progress, but here’s the thinking on this so far.
There is some obvious overlap but also a clear delineation. In particular when it comes to UI composition. MEF can be used for UI composition for sure, however it doesn’t have specific UI composition bits like RegionManager, Composite Commands, EventAggregator. Something like EventAgg will come in the future, but it is highly unlikely we will ever deliver some of the Prism UI-specific bits as part of MEF. That could change, but at least today that is the case.
In general though here are the differences.
There are two primary use cases we hear from customers who want to use MEF and Prism together.
Note: You can also use MEF for some aspects of UI composition, particularly for pull-style regions which import their UI elements.
The first angle is primarily for customers who have existing applications that use Prism and want to use MEF. The second is for customers who are building new apps in SL4/FX4, that want to use MEF for providing the foundation, and pull in CAL libraries where appropriate. I think both make equal sense depending on customer needs.
In terms of which to use when, my advice is it depends on your situation.