Exemple #1
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();

            // Setup factory, delegator (bus) and store
            var aggregateFactory = new AggregateFactory();
            var eventDelegator = new EventDelegator();
            var eventStore = new EventStore(eventDelegator);

            // Create new commandprocessor and add it to IoC
            SetupCommandProcessor(services, eventStore, aggregateFactory);

            // Create new view for getAllReservations and add it to IoC
            SetupViews(services, eventDelegator);
        }
Exemple #2
0
        private static void SetupCommandProcessor(IServiceCollection services, EventStore eventStore, AggregateFactory aggregateFactory)
        {
            var commandProcessor = new CommandProcessor(eventStore, aggregateFactory);

            services.AddSingleton<IProcessCommands>(provider => commandProcessor);
        }