Using MEF in a windows service?
I'd like to use MEF in a windows service / WCF se开发者_JAVA百科rvice.
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?
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.
精彩评论