Is there a WebActivatorEx equivalent for Windows Services?

218 views Asked by At

I want to be able to utilise a C# assembly which can be easily be initialised in a decoupled manner to set up some (AutoMapper) configuration at start-up. WebActivator allows me to do this.

But I also want to be able to utilise this assembly in a Windows Service Host environment which I want to be completely decoupled also. Is there something equivalent to WebActivatorEx that I can use?

1

There are 1 answers

0
Redeemed1 On BEST ANSWER

In the absence of a response to this question (probably because it was badly worded and a bit questionable in its approach) I came back to it today and decided to look again.

As I want to be able to host an MEF enabled plugin I had used WebActivator to get it working in MVC.

On the WebActivator page I noticed the following comment at the bottom of the page under the heading Support for invoking the start methods outside of ASP.NET

if you are using some 'WebActivated' NuGet packages from a different type of apps (say a Console app), it could make sense to have add calls to Run() and RunShutdownMethods() at the beginning and end of your app

In my case the WebActivator.ActivationManager.RunPreStartMethods() would provide what I wanted. This approach (although it feels a bit hacky!) would allow me to run the same plugin (without Web dependencies) from a Windows Service.