Пример #1
0
        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();
        }
Пример #2
0
        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");
        }
Пример #3
0
        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();
        }