Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using MEF in a windows service?

I'd like to use MEF in a windows service / WCF service.

The configuration of the AggregateCatalog is no problem, but what do I do with the methods CreateShell() and InitializeShell()? The service can't have a shell, so do I just return null?

And where would I create and run the bootstrapper? In OnStart of the Service class?

like image 817
Sam Avatar asked Nov 28 '25 01:11

Sam


1 Answers

MEF doesn't have CreateShell and InitializeShell methods. I think those are methods that Prism uses. Prism is a UI application framework which uses MEF. Since you are writing a service, you wouldn't use Prism, but you could use MEF.

Create a CompositionContainer connected to the catalog you've created, and then you can pull exports from the container.

like image 102
Daniel Plaisted Avatar answered Dec 01 '25 04:12

Daniel Plaisted