Exemplo n.º 1
0
        public static void BootUp(IEventHandler <NewNoteAdded> handler, TextChangedHandler textChangedHandler)
        {
            var config = new StructureMapConfiguration(cfg =>
            {
                cfg.For <ICommandService>().Use(InitializeCommandService);
                cfg.For <IEventBus>().Use(InitializeEventBus(handler, textChangedHandler));
                cfg.For <IEventStore>().Use(InitializeEventStore);
                cfg.For <ISnapshotStore>().Use(InitializeSnapshotStore);
                cfg.For <IUnitOfWorkFactory>().Use(() => new SnapshottingUnitOfWorkFactory());
            });

            NcqrsEnvironment.Configure(config);
        }
Exemplo n.º 2
0
        private static IEventBus InitializeEventBus(IEventHandler <NewNoteAdded> handler, TextChangedHandler textChangedHandler)
        {
            var bus = new InProcessEventBus();

            bus.RegisterHandler(handler);
            bus.RegisterHandler(textChangedHandler);

            return(bus);
        }