Installers are custom types that implement the IWindsorInstaller
interface and are used to register Component
s to the container, using the fluent registration API.
public class MyInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Component.For<IMyType>()
.ImplementedBy<ConcreteMyType1>());
//Registering several components in one call to .Register
container.Register(
Component.For<IFoo>().ImplementedBy<Foo>(),
Component.For<IBar>().ImplementedBy<Bar());
}
}
//To use the installer:
WindsorContainer container = new WindsorContainer();
container.Install(new MyInstaller());
container.Resolve<IFoo>();
Keep in mind
Installers must have public default constructor: When installers are instantiated by Windsor, they must have public default constructor. Otherwise an exception will be thrown.