JimBobBennett
JimBobBennett

Reputation: 19

Are there any C# "service" libraries

Once again I find myself creating an IService interface, with start, stop, status etc. Then building a manager to start the services, having service dependencies, a class to ensure that there are no circular dependencies etc. All fairly standard stuff, done it a few times now in different jobs.

Surely there must be a library out on nuget? Or possibly a way using MEF? But I can't find anything, google being saturated with results on Windows Services, WCF services etc.

Does anyone know of such a thing, or if a "service" isn't the correct name, what I can search for?

Just to clarify with an example:

I need a service to authenticate my user, a service to provide application data and a service to provide static data. The application data service depends on the authentication service as the user has to be authenticated before getting any data. So I'm after a library where I can create these services implementing an IService interface, specifying the dependency. Then call Start on a ServiceManager and this will start the authentication service and the static data service, and once the user is authenticated and the authentication service is therefore started, it will start the application data service. I've written this a few times now in various jobs (so can't reuse the code), so is there a library out there that provides the generic functionality I need.

Upvotes: 1

Views: 173

Answers (2)

Stefan H
Stefan H

Reputation: 6683

The windows services implement ServiceBase (a class)

This can be found in System.ServiceProcess

Other than that, I'm not sure of any interfaces...

http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.aspx

Upvotes: 1

kenny
kenny

Reputation: 22344

I've rolled my own using Topshelf and an IoC.

Upvotes: 1

Related Questions