Beispiel #1
0
        public static ConsoleEnvironment BuildEnvironment()
        {
            var handler = new SynchronousEventHandler();
            var store = new InMemoryStore(handler);

            var blueprints = new InMemoryBlueprintLibrary();
            blueprints.Register("model-t", new CarPart("wheel",4), new CarPart("engine",1), new CarPart("chassis",1));
            var fas = new FactoryApplicationService(store, blueprints);

            // wire projections
            var activeFactories = new ActiveFactoriesProjection();
            handler.RegisterHandler(activeFactories);

            var workerRegistry = new WorkerRegistryProjection();
            handler.RegisterHandler(workerRegistry);

            var inventory = new InventoryProjection();
            handler.RegisterHandler(inventory);

            return new ConsoleEnvironment
                {
                    Events = store,
                    FactoryAppService = fas,
                    Handlers = ConsoleActions.Actions,
                    Blueprints = blueprints,
                    ActiveFactories = activeFactories,
                    WorkerRegistry = workerRegistry,
                    Inventory = inventory
                };
        }
Beispiel #2
0
 public InMemoryStore(SynchronousEventHandler handler)
 {
     _handler = handler;
 }