Example #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
        }
        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
 
        }
        public void SetUp()
        {
            new DomainDatabaseBootStrapper().ReCreateDatabaseSchema();

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

            _domainEventStorage = new DomainEventStorage(sqliteConnectionString, new BinaryFormatter());
            _eventStoreIdentityMap = new EventStoreIdentityMap();
            _eventStoreUnitOfWork = new EventStoreUnitOfWork(_domainEventStorage, _eventStoreIdentityMap, new Mock<IBus>().Object);
            _repository = new DomainRepository(_eventStoreUnitOfWork, _eventStoreIdentityMap);
        }
        public void SetUp()
        {
            new DomainDatabaseBootStrapper().ReCreateDatabaseSchema();

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

            _domainEventStorage    = new DomainEventStorage <IDomainEvent>(sqliteConnectionString, new BinaryFormatter());
            _eventStoreIdentityMap = new EventStoreIdentityMap <IDomainEvent>();
            _eventStoreUnitOfWork  = new EventStoreUnitOfWork <IDomainEvent>(_domainEventStorage, _eventStoreIdentityMap, new Mock <IBus>().Object);
            _repository            = new DomainRepository <IDomainEvent>(_eventStoreUnitOfWork, _eventStoreIdentityMap);
        }
        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);
        }
        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);
        }