Still confused about MEF

I wrote at
this and
this in Wes' Puzzleblock blog. And he directed me here . I am wondering that I am missing a huge idea behind MEF. But the examples that are provided looks quite similar to the one I had done.(Look at the second link).

What am I missing?

Also, I have to say that the code snippets are done without looking deep into MEF and as a POC.

As Wes said, your sample will work, but 1) what MEF provided is much more than instantiation and wiring-up. There are lots of other capabilities you can leverage on MEF such as lazy loading, metadata-based discovery, duck typing, catalog
and so on 2) More importantly, with MEF you do not have to create your own plug-in infrastructure from scratch where your plug-in can only be used in your application (as your sample) or you have to duplicate your hosting code in every application.

You may find more detailed information in our wiki pages. Hope this answered some of your questions.

Thanks Zhenlan. My code looks app specific simply because I wrote it that way. Actually come to think of it, the code is generic from a Console application POV. It is a console app that will load any class that implements ITask, for now at the start of
the app but that can be made dynamic. Also moving that to a separate Assembly and Gacing it would make it more generic.

Hi Ganesh, I absolutely understand your code is just a sample (a great sample!). It can be made much more complex to provide even more functionalities than MEF. Actually, this is what people are doing now - creating their own plug-in model infrastructure.

My question is - if there is a MEF already existing in your .Net Framework, do you have any interest to take advantage it? If not, can you let us know why? Your feedback will be very valuable for us to improve MEF.

Thanks for your feedback!

Zhenlan

ps. MEF also provides many extension points to itself so that people can customize MEF for their specific needs.

WRT your question, we are currently working hard to make it as simple as possible for people to create their custom programming models and resolvers. I am not sure about your specific scenarios, but with some customization of MEF, it is
possible for people to take advantage of the MEF composition engine and have it working with existing parts.

A part of the same type as other parts implementing a same interface might use a specific assembly, say
aSpecificAssembly.dll. In order to make the said part workable there should be a way of announcing the dependency to
aSpecificAssembly.dll

How can this be done? If we do not do this, one has to wait till QA catching this.

A part of the same type as other parts implementing a same interface might use a specific assembly, say
aSpecificAssembly.dll. In order to make the said part workable there should be a way of announcing the dependency to
aSpecificAssembly.dll

How can this be done? If we do not do this, one has to wait till QA catching this.