public void Start() { Log.Assign(new Log4NetLog(LogManager.GetLogger(typeof(Host)))); _container = new WindsorContainer(); _container.RegisterDataAccessCore(); _container.RegisterDataAccess("Shuttle.Sentinel"); _container.RegisterDataAccess("Shuttle.Recall.SqlServer"); _container.Register(Component.For <IDatabaseContextCache>().ImplementedBy <ThreadStaticDatabaseContextCache>()); _container.Register(Component.For <IEventStore>().ImplementedBy <EventStore>()); _container.Register(Component.For <IKeyStore>().ImplementedBy <KeyStore>()); _container.Register(Component.For <ISerializer>().ImplementedBy <DefaultSerializer>()); _container.Register(Component.For <IEventStoreQueryFactory>().ImplementedBy <EventStoreQueryFactory>()); _container.Register(Component.For <IKeyStoreQueryFactory>().ImplementedBy <KeyStoreQueryFactory>()); _container.Register(Component.For <IProjectionService>().ImplementedBy <ProjectionService>()); _container.Register(Component.For <IProjectionConfiguration>().Instance(ProjectionSection.Configuration())); _container.RegisterConfiguration(SentinelSection.Configuration()); _container.Register(Component.For <object>().ImplementedBy <UserProjectionHandler>().Named("UserProjectionHandler")); _processor = EventProcessor.Create(c => { c.ProjectionService(_container.Resolve <IProjectionService>()); }); _processor.AddEventProjection(new EventProjection("User").AddEventHandler(_container.Resolve <object>("UserProjectionHandler"))); _processor.Start(); }
private void ConfigureWindsorContainer() { _container = new WindsorContainer(); _container.RegisterDataAccessCore(); _container.RegisterDataAccess("Shuttle.Sentinel"); _container.Register(Component.For <IDatabaseContextCache>().ImplementedBy <ContextDatabaseContextCache>()); _container.RegisterConfiguration(SentinelSection.Configuration()); _container.Register("Shuttle.Sentinel.WebApi", typeof(ApiController), "Controller"); _container.Register("Shuttle.Sentinel", "Service"); }
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(); }