コード例 #1
0
        public void WhenIScheduleAMeeting()
        {
            var scheduleMeetingCommand = new ScheduleMeetingCommand(MEETING_ID, meetingDate, locationId, speakerId, capacity);

            new DomainDatabaseBootStrapper().ReCreateDatabaseSchema();

            var sqliteConnectionString = string.Format("Data Source={0}", DATA_BASE_FILE);

            var domainEventStorage    = new DomainEventStorage <IDomainEvent>(sqliteConnectionString, new BinaryFormatter());
            var eventStoreIdentityMap = new EventStoreIdentityMap <IDomainEvent>();
            var bus = new DirectBus(new MessageRouter());
            var eventStoreUnitOfWork = new EventStoreUnitOfWork <IDomainEvent>(domainEventStorage, eventStoreIdentityMap, bus);
            var repository           = new DomainRepository <IDomainEvent>(eventStoreUnitOfWork, eventStoreIdentityMap);

            new ReportingDatabaseBootStrapper().ReCreateDatabaseSchema();
            reportingRepository = new SQLiteReportingRepository(sqliteConnectionString, new SqlSelectBuilder(), new SqlInsertBuilder(), new SqlUpdateBuilder(), new SqlDeleteBuilder());

            handler = new ScheduleMeetingCommandHandler(repository);

            var messageRouter = new MessageRouter();

            messageRouter.Register <ScheduleMeetingCommand>(command => handler.Handle(command));

            bus.Publish(scheduleMeetingCommand);

            //how do we publish to report, directly or via command handler. Looks like by using transaction handler we go through unit of work whose commit method fires events to BUS
            //so if we have event and then save they get re-ublished and report canpick up
        }
コード例 #2
0
        public void WhenIScheduleAMeeting()
        {
            var scheduleMeetingCommand = new ScheduleMeetingCommand(MEETING_ID, meetingDate, locationId, speakerId, capacity);

            new DomainDatabaseBootStrapper().ReCreateDatabaseSchema();

            var sqliteConnectionString = string.Format("Data Source={0}", DATA_BASE_FILE);

            var domainEventStorage = new DomainEventStorage<IDomainEvent>(sqliteConnectionString, new BinaryFormatter());
            var eventStoreIdentityMap = new EventStoreIdentityMap<IDomainEvent>();
            var bus = new DirectBus(new MessageRouter());
            var eventStoreUnitOfWork = new EventStoreUnitOfWork<IDomainEvent>(domainEventStorage, eventStoreIdentityMap, bus);
            var repository = new DomainRepository<IDomainEvent>(eventStoreUnitOfWork, eventStoreIdentityMap);

            new ReportingDatabaseBootStrapper().ReCreateDatabaseSchema();
            reportingRepository = new SQLiteReportingRepository(sqliteConnectionString, new SqlSelectBuilder(), new SqlInsertBuilder(), new SqlUpdateBuilder(), new SqlDeleteBuilder());

            handler = new ScheduleMeetingCommandHandler(repository);

            var messageRouter = new MessageRouter();
            messageRouter.Register<ScheduleMeetingCommand>(command => handler.Handle(command));

            bus.Publish(scheduleMeetingCommand);

            //how do we publish to report, directly or via command handler. Looks like by using transaction handler we go through unit of work whose commit method fires events to BUS
            //so if we have event and then save they get re-ublished and report canpick up
 
        }
コード例 #3
0
        protected override void Context()
        {
            new DomainDatabaseBootStrapper().ReCreateDatabaseSchema();

            var sqliteConnectionString = string.Format("Data Source={0}", DATA_BASE_FILE);

            var domainEventStorage = new DomainEventStorage<IDomainEvent>(sqliteConnectionString, new BinaryFormatter());
            var eventStoreIdentityMap = new EventStoreIdentityMap<IDomainEvent>();
            var eventStoreUnitOfWork = new EventStoreUnitOfWork<IDomainEvent>(domainEventStorage, eventStoreIdentityMap, MockRepository.GenerateStub<IBus>());
            repository = new DomainRepository<IDomainEvent>(eventStoreUnitOfWork, eventStoreIdentityMap);

            scheduleMeetingCommand = new ScheduleMeetingCommand(meetingId, meetingTime, locationId, speakerId, CAPACITY);

            scheduleMeetingCommandHandler = new ScheduleMeetingCommandHandler(repository);
        }
コード例 #4
0
        protected override void Context()
        {
            new DomainDatabaseBootStrapper().ReCreateDatabaseSchema();

            var sqliteConnectionString = string.Format("Data Source={0}", DATA_BASE_FILE);

            var domainEventStorage    = new DomainEventStorage <IDomainEvent>(sqliteConnectionString, new BinaryFormatter());
            var eventStoreIdentityMap = new EventStoreIdentityMap <IDomainEvent>();
            var eventStoreUnitOfWork  = new EventStoreUnitOfWork <IDomainEvent>(domainEventStorage, eventStoreIdentityMap, MockRepository.GenerateStub <IBus>());

            repository = new DomainRepository <IDomainEvent>(eventStoreUnitOfWork, eventStoreIdentityMap);

            scheduleMeetingCommand = new ScheduleMeetingCommand(meetingId, meetingTime, locationId, speakerId, CAPACITY);

            scheduleMeetingCommandHandler = new ScheduleMeetingCommandHandler(repository);
        }