Skip to content
Jean-Pierre Bachmann edited this page Nov 11, 2015 · 3 revisions

How to Install and Setup the MSEF:

Step 1

https://www.nuget.org/packages/MSEF/ Download via Nutget Package. If you are using the command line type:

PM> Install-Package MSEF

else search for MSEF

Step 2

Call

ServicePoolFactory.CreatePool()

in you'r executable as soon as possible. You can wrap it into a Task if necessary.

Step 3

Create a DLL called (Name is just Semantic sugar) *.Contracts.dll where * is your application common name. Inside this DLL Extend the IService interface for your Business logic like IFooService. All shared Definitions that must be known to all of your DLL's should be located here, there must be no direct connection between each Dll.

Step 4

Implement your interface IFooService and mark it for export by using the ServiceExportAttribute located in the JPB.Shell.Contracts DLL.

Step 5

Ensure that all DLL's are compiled into the same folder as the Startup Project. To enforce this set the Output path of each DLL you use, to the same path like ..\..\..\..\bin\VS Output\ This will ensure that the MSEF can find all corresponding DLL's

Step 6

Obtain your IFooService implimentation ANYWHERE by calling JPB.Shell.MEF.Services.ServicePool.Instance.GetSingleService()


if you followed the steps exactly you will obtain your service without knowing the Implementation. If you are struggling with that feel free to contact me: Jean-Pierre_Bachmann@live.de (Englisch or German Preferred)

Clone this wiki locally