When organizing a project where should I put the provider interfaces which are used in MEF? Currently I just have them in the same project as everything else but it seems like it might desirable for me to extract them into a separate dll such that it was a very small dll and would easily be linked to by others attempting to write extensions. What is good practise for this?
When organizing a project where should I put the provider interfaces which are used
Share
As with any plug-in/extension model, you should put your “contracts” (the interfaces a plug-in author should be implementing) in an assembly separate from your application.
That way you can make that assembly available to plug-in authors without having to give them the entire application – useful if it’s a commercial app that you need to license separately.
MEF Preview 5 introduces the ability to export an interface (ie add an [Export] attribute to an interface) such that any implementor of that interface is automatically exported. That means that plug-in authors don’t even need to know about MEF – they just implement your interface and they’re automatically a MEF extension.