예제 #1
0
        public void TestFixtureSetUp()
        {
            _eventstore = Wireup
                          .Init()
                          .UsingMongoPersistence("events", new DocumentObjectSerializer())
                          .Build();

            MongoDBRegistration.Register();
        }
예제 #2
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            var readModel = new MongoUrl(ConfigurationManager.ConnectionStrings["readmodel"].ConnectionString);
            MongoPersistenceOptions options = new MongoPersistenceOptions();

            options.ServerSideOptimisticLoop = false;
            container.Register(
                Classes
                .FromAssemblyInThisApplication()
                .BasedOn(typeof(IEventHandler <>))
                .WithServiceAllInterfaces()
                .LifestyleTransient(),

                Component
                .For <NotifyReadModelUpdates>(),

                Component
                .For <MongoDatabase>()
                .UsingFactoryMethod(k => new MongoClient(readModel).GetServer().GetDatabase(readModel.DatabaseName)),

                Component
                .For <IDispatchCommits>()
                .ImplementedBy <CommitsDispatcher>(),

                Component
                .For <IRepository>()
                .ImplementedBy <EventStoreRepository>()
                .LifeStyle.Transient,

                Component
                .For <IConstructAggregates>()
                .ImplementedBy <AggregateFactory>(),

                Component
                .For <IDetectConflicts>()
                .ImplementedBy <ConflictDetector>()
                .LifestyleTransient(),

                Component
                .For <ProjectionEngine>()
                .Start(),

                Component.For <IStoreEvents>().UsingFactoryMethod(k =>
                                                                  Wireup.Init()
                                                                  .UsingMongoPersistence("events", new DocumentObjectSerializer(), options)
                                                                  .InitializeStorageEngine()
                                                                  .UsingSynchronousDispatchScheduler(k.Resolve <IDispatchCommits>())
                                                                  .Build()
                                                                  )
                );

            MongoDBRegistration.Register();
        }
예제 #3
0
        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            container.Register(
                Component
                .For <IDispatchCommits>()
                .ImplementedBy <CommitsDispatcher>(),

                Component
                .For <ISagaRepository>()
                .ImplementedBy <SagaEventStoreRepository>()
                .LifestyleTransient(),

                Component.For <IStoreEvents>()
                .UsingFactoryMethod(k =>
                                    Wireup.Init()
                                    .UsingMongoPersistence("pm", new DocumentObjectSerializer())
                                    .InitializeStorageEngine()
                                    .UsingSynchronousDispatchScheduler(k.Resolve <IDispatchCommits>())
//                                                   .UsingAsynchronousDispatchScheduler(k.Resolve<IDispatchCommits>())
                                    .Build()
                                    )
                );
            MongoDBRegistration.Register();
        }