public static PretendApplication Bootstrap() { var store = new InMemoryEventStore(); var handlerFactory = new CommandHandlerFactory(store); var dispatcher = new CommandDispatcher(handlerFactory); var mongoDb = new MongoDb(); var eventHandlerFactory = new EventHandlerFactory(store, dispatcher, mongoDb); var eventDispatcher = new EventDispatcher(eventHandlerFactory); var eventProcessor = new EventProcessor(store, eventDispatcher); return(new PretendApplication(mongoDb, dispatcher)); }
public static PretendApplication Bootstrap(bool deleteDatabase = false) { if (app != null) { return(app); } //var store = new MongoDbEventStore(new TypeResolver()); // MongoDb Store var store = new InMemoryEventStore(); // In-Memory Event Store if (deleteDatabase) { store.DeleteDatabase(); } var handlerFactory = new CommandHandlerFactory(store); var eventHandlerFactory = new EventHandlerFactory(store, handlerFactory); var eventDispatcher = new EventDispatcher(eventHandlerFactory); // TODO Merge also EventDispatcher and EventHandlerFactory? var eventProcessor = new EventProcessor(store, eventDispatcher); // TODO: what that here for? var dataReader = new DataReader(store, eventHandlerFactory); app = new PretendApplication(handlerFactory, store, dataReader); return(app); }