I'm just starting to deal with MEF. The task is this. There is an application that processes data. Data is taken from the database. But I am not sure of the choice of base, so I decided to provide for extensibility and the possibility of choosing the right base. I was looking for how to implement this, the choice fell on MEF. But not everything is clear to me.

  • How to get an interface to be implemented in a third-party project (when writing a plugin)?
  • Where does the plugin get the data types used in the project? Well, for example, a plugin should return an object of type MyClass. Where does the plugin have to get its designer, etc.?
  • Can I write a plugin outside of the framework?
  • Why do you have a base? I now use Hiberneyt, which out of the box knows a bunch of DBMS and does not think about the plug-ins \ MEF. - Monk
  • @Monk, I will not need plugins for the database only. Still, for example, for parsing documents into text (doc, docx, pdf, html) - iRumba

1 answer 1

Not an answer, but rather a question for you on the topic.

Are you sure that MEF is right for you? As far as I know, when working with MEF you will have pretty strong isolation between the host and the plugins. This is convenient for some large things - for example, IDE and plugins to it, when a plug-in clinging through MEF is responsible for many things at once. For the case when you need to unleash on several interfaces, it will be too cumbersome.

Look towards the Inversion of Control (IoC) and Dependency Injection (DI) frameworks, for example, Unity .

  • I do not understand. Which plan is cumbersome? In the same place only the declaration of the interface, its implementation on the side of the plug-in and several attributes for import / export. Everything, except attributes, and so I have to do. So why not deploy it in MEF? - iRumba