static Startup() { _container = new WindsorContainer() // app.config first, so we can override registrations if we want/have to .Install(WConfiguration.FromAppConfig(), FromAssembly.This()); _hostSettings = _container.Resolve <IHostSettings>(); }
private void InstallComponents() { Install(FromAssembly.InThisApplication()); Install(Configuration.FromAppConfig()); //Install(Configuration.FromXml(GetConfigResource())); var services = new ServiceCollection(); new NHibernateInstaller().Install(services); new CoreContainerRegistration().Install(services); new DataEntitiesContainerRegistration().Install(services); services.AddSingleton <IOptions <PathConfiguration>, PathConfigImplementation>(); // TODO after switch to ASP.NET Core use framework options handler services.RegisterFulltextServiceClientComponents(new FulltextServiceClientConfiguration { Url = new Uri(ConfigurationManager.AppSettings["FulltextServiceEndpoint"]), CreateCustomHandler = false }); this.AddServicesCollection(services); // Re-register UnitOfWorkProvider to satisfy dependency Register(Component.For <UnitOfWorkProvider>() .IsDefault() .UsingFactoryMethod(c => new UnitOfWorkProvider(c.ResolveAll <IUnitOfWork>().Select(x => new KeyValuePair <object, IUnitOfWork>(null, x)).ToList())) .LifestylePerWebRequest() ); }
static IWindsorContainer ConfigureIoC() { var container = new WindsorContainer(); container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel, true)); container.Install(Configuration.FromAppConfig(), FromAssembly.This(), FromAssembly.Containing <GuestBookXmlProvider>()); return(container); }