I want to expose few methods (or interfaces) from my ERP application and my clients want to add their own modules to achieve some functionality. For instance, we can write our own add-in modules to visual studio.
Kindly let me know how to achieve this.
I totally agree with Rob, but let me extend Rob’s answer a little.
MEF is quite heavy and verbose. I mean you have to implement a lot of special classes derived from MEF’s interfaces, and in most cases they will be just a standard realisation of interface, no special logic. So if you don’t need all this heavy functionality and want some lightweight solution – implement your own following steps in Rob’s answer. I talk about previous versions of MEF, I don’t know whether the last version is more convenient to use than previous.
If you decide to go with implementing your own plug-ins architecture, I heavily advice you to consider using Microsoft patterns and practices Unity for plug-ins instantiation. This will eliminate headache about how to initialize plug-ins, because Unity will take care of dependencies, required by plug-ins via plug-ins constructors. You just need to declare interfaces, that you want to expose as API. And plug-ins developers should only reference these interfaces in plug-ins constructors. Unity is quite lightweight and easy to use.