public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); var container = new WindsorContainer(); var componentContainer = new WindsorComponentContainer(container); componentContainer.RegisterInstance <IAccessConfiguration>(AccessSection.Configuration()); componentContainer.RegisterSuffixed("Shuttle.Sentinel"); componentContainer.RegisterSuffixed("Shuttle.Access.Sql"); componentContainer.Register <IInspectionQueue, DefaultInspectionQueue>(); componentContainer.Register <IHttpContextAccessor, HttpContextAccessor>(); componentContainer.Register <IDatabaseContextCache, ContextDatabaseContextCache>(); ServiceBus.Register(componentContainer); EventStore.Register(componentContainer); componentContainer.Resolve <IDataStoreDatabaseContextFactory>().ConfigureWith("Sentinel"); componentContainer.Resolve <IDatabaseContextFactory>().ConfigureWith("Sentinel"); var inspectionQueue = componentContainer.Resolve <IInspectionQueue>(); _bus = ServiceBus.Create(componentContainer).Start(); return(WindsorRegistrationHelper.CreateServiceProvider(container, services)); }
public void ConfigureServices(IServiceCollection services) { services.AddSingleton <IWindsorContainer>(new WindsorContainer()); services.AddSingleton <IControllerActivator, ControllerActivator>(); services.AddSingleton(AccessSection.Configuration()); services.AddSingleton(SentinelSection.Configuration()); services.AddSingleton <IDbProviderFactories, DbProviderFactories>(); services.AddSingleton <IConnectionConfigurationProvider, ConnectionConfigurationProvider>(); services.AddSingleton <IDatabaseContextCache, ContextDatabaseContextCache>(); services.AddSingleton <IDatabaseContextFactory, DatabaseContextFactory>(); services.AddSingleton <IDatabaseGateway, DatabaseGateway>(); services.AddSingleton <IDbConnectionFactory, DbConnectionFactory>(); services.AddSingleton <IDbCommandFactory, DbCommandFactory>(); services.AddSingleton <IQueryMapper, QueryMapper>(); services.AddSingleton <ISessionQueryFactory, SessionQueryFactory>(); services.AddSingleton <ISessionQuery, SessionQuery>(); services.AddMvc(); services.AddCors(); }