Using MEF instead of Unity

Topics: Silverlight Integration Pack
Jun 15, 2011 at 7:10 AM

Hi, 

I want to know, is there any way to use MEF instead of Unity in Silverlight Integration Pack for resolving objects such as Logwriter, ...?

Thanks.

Jun 15, 2011 at 7:56 AM

Hi,

According to Gregori Melnik (one of the authors of Silverlight Integration Pack) in Channel 9, that it is possible though he mentioned creating MEFConfigurator to make it happen. For more details, just follow this link. Hope this helps. :)

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 15, 2011 at 8:57 AM
Edited Jun 15, 2011 at 8:59 AM
Hi Noel,

Thanks for your fast answer. It seems that it could be a little time consuming to create a MEFConfigurator and I can't afford it. So, I have an Idea and wanted to share it with you to know your insights.

Would it be a good idea to create an instance of LogWriter (for example) using Unity in ConfigureContainer method of Bootstrapper and add it to the MEF container using the ComposeExportedValue extension method. Doing so other imports can resolve the added object using MEF. Although in this case I have to add Unity references to the Silverlight applications. 
Thanks.
Jun 15, 2011 at 9:12 AM
Edited Jun 15, 2011 at 9:20 AM

To be honest, I haven't worked with MEF yet so I can't tell exactly if that would be feasible or not. The best way to verify it is none other than trying it out :). But my personal insight to this is you will have a hard dependency in Unity on resolving objects. If that is so, then why not just solely use Unity instead?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com