IKernel kernel = new StandardKernel( new InlineModule( x => x.Bind().To(), x => x.Bind().To(), x => x.Bind().ToSelf() )); ObjectFactory.Initialize(x => { x.UseDefaultStructureMapConfigFile = false; x.ForRequestedType() .TheDefaultIsConcreteType() .CacheBy(InstanceScope.Singleton); x.ForRequestedType() .TheDefaultIsConcreteType() .CacheBy(InstanceScope.Singleton); x.ForConcreteType(); }); container.RegisterType() .RegisterType(); IWindsorContainer container = new WindsorContainer(); container.AddComponentWithLifestyle("CustomerRepository", LifestyleType.Singleton); container.AddComponentWithLifestyle("CustomerService",LifestyleType.Singleton); container.AddComponent("Form1"); var builder = new ContainerBuilder(); builder.Register() .As() .ContainerScoped(); builder.Register() .As() .ContainerScoped(); builder.Register();