Service Provider using Castle Windsor container for ASP.NET Core 3.x. Fully replaces ASP.NET Core Default Service Provider (container). Supports both registering services
- using
IServiceCollection
(Startup.ConfigureServices
) - these get translated to Castle Windsor registrations Startup.ConfigureContainer
public void ConfigureContainer (IWindsorContainer container) { container.Install(new MyInstaller()); }
The work has been heavily inspired by https://github.com/volosoft/castle-windsor-ms-adapter and https://github.com/seesharper/LightInject.Microsoft.DependencyInjection
- Add
UseWindsorContainerServiceProvider()
when creating the HostThis will registerHost.CreateDefaultBuilder(args) .UseWindowsService() .UseWindsorContainerServiceProvider()
IServiceProviderFactory
- Any services registred in
Startup.ConfigureServices
will be registered withIWindsorContainer
. No need to cross-wire sinceIWindsorContainer
is the onlyIServiceProvider
- To match lifecycle your custom components to ASP.NET Core scope, use
LifeStyle.ScopedToNetCoreScope()
- To access the container inject either
IWindsorContainer
orIServiceProvider
Apache 2.0