tags:

views:

48

answers:

1

I would like to use MEF to find my extensions but keep the responsibility for creating them to Ninject or a custom factory. Is that possible?

+1  A: 

See the article: "Export Providers and Custom factories with MEF", by Glenn Block http://codebetter.com/blogs/glenn.block/archive/2008/11/30/export-providers-and-custom-factories-with-mef.aspx.

You can read some bits about possibilities to use custom factories.

In this article, you will see links to 2 other, by Matt Hawley: "MEF + Factories", and "MEF + Factories Using an Export Provider"

Great posts indeed, although I didn't like the solution. It would be much nicer to have something similar to what they do in Ria Services. Ex: ExportFactory.Factory = new MyCustomFactory(); And that's it, I control the object creation :)
andrecarlucci