alexandrnikitin / Topshelf.autofac
Licence: mit
Topshelf.Autofac provides extensions to construct your service class from your Autofac IoC container.
Stars: ✭ 42
Topshelf.Autofac
Topshelf.Autofac provides extensions to construct your service class from your Autofac IoC container.
Install
It's available via nuget package
PM> Install-Package Topshelf.Autofac
Example Usage
static void Main(string[] args)
{
// Create your container
var builder = new ContainerBuilder();
builder.RegisterType<SampleDependency>().As<ISampleDependency>();
builder.RegisterType<SampleService>();
var container = builder.Build();
HostFactory.Run(c =>
{
// Pass it to Topshelf
c.UseAutofacContainer(container);
c.Service<SampleService>(s =>
{
// Let Topshelf use it
s.ConstructUsingAutofacContainer();
s.WhenStarted((service, control) => service.Start());
s.WhenStopped((service, control) => service.Stop());
});
});
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].