Skip to content
Topshelf.Unity provides extensions to construct your service class from your Unity IoC container.
Branch: master
Clone or download
Pull request Compare This branch is even with alexandrnikitin:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.nuget
build
src
.gitignore
CHANGELOG.md
LICENSE
README.md
Topshelf.Unity.sln

README.md

Topshelf.Unity

Topshelf.Unity provides extensions to construct your service class from your Unity IoC container.

Install

It's available via nuget package
PM> Install-Package Topshelf.Unity

Example Usage

static void Main(string[] args)
{
        // Create your container
        var container = new UnityContainer();
        container.RegisterType<ISampleDependency, SampleDependency>();
        container.RegisterType<SampleService>();

        HostFactory.Run(c =>
        {
            // Pass it to Topshelf
            c.UseUnityContainer(container);

            c.Service<SampleService>(s =>
            {
                // Let Topshelf use it
                s.ConstructUsingUnityContainer();
                s.WhenStarted((service, control) => service.Start());
                s.WhenStopped((service, control) => service.Stop());
            });
        });
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.