Is there a Best practice/pattern for updating components with MEF?

May 31, 2009 at 9:09 PM

Is there any discussion, guide, blog or reference for how to support updated components with MEF? I'm looking to create a long running service (Windows Service) that utilizes MEF and would like to know the options/mechanisms I can use to get updated components onto the system.

Ideally it would not require the recycling of the service, but if the fact that the CLR doenst support unloading means we cant do that - then recycling of the service would still work. There are a couple of ways I could see it being done, but before even thinking about reinventing the wheel I figured it would be more sensible to ask first :-). I've seen the "Unloading Addin" (and therefore the ShadowCopy discussion), both of these seem applicable.

I would think this would be a good candidate for the MEF FAQ as I suspect this will become a common request, and even if there isn't direct support in MEF to help in this arena I imagine some guidance (imagine Patterns & Practices :-) ) would be greatly appreciated by the community rather than each person inventing their own implementation.

Many thanks in advance,

Gareth