예제 #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var bus  = new FakeBus();
            var ebus = new EventBus();

            var storage  = new EventStore(ebus);
            var rep      = new Repository <InventoryItem>(storage);
            var commands = new InventoryCommandHandlers(rep);

            bus.RegisterHandler <CheckInItemsToInventory>(commands.Handle);
            bus.RegisterHandler <CreateInventoryItem>(commands.Handle);
            bus.RegisterHandler <DeactivateInventoryItem>(commands.Handle);
            bus.RegisterHandler <RemoveItemsFromInventory>(commands.Handle);
            bus.RegisterHandler <RenameInventoryItem>(commands.Handle);
            var detail = new InventoryItemDetailView();

            ebus.RegisterHandler <InventoryItemCreated>(detail.Handle);
            ebus.RegisterHandler <InventoryItemDeactivated>(detail.Handle);
            ebus.RegisterHandler <InventoryItemRenamed>(detail.Handle);
            ebus.RegisterHandler <ItemsCheckedInToInventory>(detail.Handle);
            ebus.RegisterHandler <ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryListView();

            ebus.RegisterHandler <InventoryItemCreated>(list.Handle);
            ebus.RegisterHandler <InventoryItemRenamed>(list.Handle);
            ebus.RegisterHandler <InventoryItemDeactivated>(list.Handle);
            ServiceLocator.Bus = bus;
        }
예제 #2
0
파일: Global.asax.cs 프로젝트: sonbua/m-r
        private static void RegisterListViewEventHandlers(FakeBus bus)
        {
            var list = new InventoryListView();

            bus.RegisterHandler <InventoryItemCreated>(list.Handle);
            bus.RegisterHandler <InventoryItemRenamed>(list.Handle);
            bus.RegisterHandler <InventoryItemDeactivated>(list.Handle);
        }
예제 #3
0
파일: Global.asax.cs 프로젝트: sonbua/m-r
        private static void RegisterDetailsViewEventHandlers(FakeBus bus)
        {
            var detail = new InventoryItemDetailView();

            bus.RegisterHandler <InventoryItemCreated>(detail.Handle);
            bus.RegisterHandler <InventoryItemDeactivated>(detail.Handle);
            bus.RegisterHandler <InventoryItemRenamed>(detail.Handle);
            bus.RegisterHandler <ItemsCheckedInToInventory>(detail.Handle);
            bus.RegisterHandler <ItemsRemovedFromInventory>(detail.Handle);
        }
        private static FakeBus StickABusInIt(IPersistentStore store)
        {
            var bus = new FakeBus();
            var depositDetector = new DepositDetector(new Repository<LabelDepositJob>(new EventStore(bus)));
            bus.RegisterHandler<FileDeposit>(depositDetector.Handle);

            var depositHandler = new DepositHandler(store);
            bus.RegisterHandler<DepositDetected>(depositHandler.Handle);

            return bus;
        }
예제 #5
0
파일: Global.asax.cs 프로젝트: sonbua/m-r
        private static void RegisterCommandHandlers(FakeBus bus)
        {
            var storage    = new EventStore(bus);
            var repository = new Repository <InventoryItem>(storage);
            var commands   = new InventoryCommandHandlers(repository);

            bus.RegisterHandler <CheckInItemsToInventoryCommand>(commands.Handle);
            bus.RegisterHandler <CreateInventoryItemCommand>(commands.Handle);
            bus.RegisterHandler <DeactivateInventoryItemCommand>(commands.Handle);
            bus.RegisterHandler <RemoveItemsFromInventoryCommand>(commands.Handle);
            bus.RegisterHandler <RenameInventoryItemCommand>(commands.Handle);
        }
        private static FakeBus StickABusInIt(IPersistentStore store)
        {
            var bus             = new FakeBus();
            var depositDetector = new DepositDetector(new Repository <LabelDepositJob>(new EventStore(bus)));

            bus.RegisterHandler <FileDeposit>(depositDetector.Handle);

            var depositHandler = new DepositHandler(store);

            bus.RegisterHandler <DepositDetected>(depositHandler.Handle);

            return(bus);
        }
예제 #7
0
        protected void Application_Start()
        {
            Bootstrapper.Start();
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            #region Bus

            var bus = new FakeBus();

            var storage = new EventStore(bus);
            var rep = new Repository<MedicalApprovalProcedure>(storage);
            var commands = new CommandHandlers(rep);
            bus.RegisterHandler<CreateMedicalProcedureApprovalRequest>(commands.Handle);
            var eventHandler = new ManteqEventHandler();
            bus.RegisterHandler<ApprovalCreated>(eventHandler.Handle);
            ServiceLocator.Bus = bus;

            #endregion Bus
        }
예제 #8
0
        protected void Application_Start()
        {
            Bootstrapper.Start();
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            #region Bus

            var bus = new FakeBus();

            var storage  = new EventStore(bus);
            var rep      = new Repository <MedicalApprovalProcedure>(storage);
            var commands = new CommandHandlers(rep);
            bus.RegisterHandler <CreateMedicalProcedureApprovalRequest>(commands.Handle);
            var eventHandler = new ManteqEventHandler();
            bus.RegisterHandler <ApprovalCreated>(eventHandler.Handle);
            ServiceLocator.Bus = bus;

            #endregion Bus
        }
예제 #9
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var bus = new FakeBus();

            var storage  = new EventStore(bus);
            var rep      = new Repository <ShoppingCart>(storage);
            var commands = new ShoppingCartCommandHandlers(rep);

            bus.RegisterHandler <CreateCart>(commands.Handle);
            bus.RegisterHandler <AddCartItem>(commands.Handle);
            bus.RegisterHandler <RemoveCartItem>(commands.Handle);
            var detail = new ShoppingCartView();

            bus.RegisterHandler <CartCreated>(detail.Handle);
            bus.RegisterHandler <CartItemAdded>(detail.Handle);
            bus.RegisterHandler <CartItemRemoved>(detail.Handle);

            var notifications = new ProductAvailabilityCommandHandlers(
                new Repository <ProductAvailabilityNotification>(storage));

            bus.RegisterHandler <RemoveProductAvailabilityNotification>(notifications.Handle);
            bus.RegisterHandler <AddProductAvailabilityNotification>(notifications.Handle);
            bus.RegisterHandler <ProductCreated>(notifications.Handle);

            var favorites = new UserFavoriteCommandHandlers(
                new Repository <UserFavorites>(storage));

            bus.RegisterHandler <UserCreated>(favorites.Handle);
            bus.RegisterHandler <AddToFavorites>(favorites.Handle);
            bus.RegisterHandler <RemoveFromFavorites>(favorites.Handle);
            ServiceLocator.Bus = bus;
            ProductDatabase.LoadFromDisk(Server.MapPath("~/produkter"));
        }
예제 #10
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var bus = new FakeBus();

            var storage = new EventStore(bus);
            var rep = new Repository<InventoryItemAggregateRoot>(storage);
            var commands = new InventoryItemCommandHandlers(rep);
            bus.RegisterHandler<InventoryItemCheckInCommand>(commands.Handle);
            bus.RegisterHandler<InventoryItemCreateCommand>(commands.Handle);
            bus.RegisterHandler<InventoryItemDeactivateCommand>(commands.Handle);
            bus.RegisterHandler<InventoryItemRemoveCommand>(commands.Handle);
            bus.RegisterHandler<InventoryItemRenameCommand>(commands.Handle);
            var detail = new InventoryItemDetailView();
            bus.RegisterHandler<InventoryItemCreatedEvent>(detail.Handle);
            bus.RegisterHandler<InventoryItemDeactivatedEvent>(detail.Handle);
            bus.RegisterHandler<InventoryItemRenamedEvent>(detail.Handle);
            bus.RegisterHandler<InventoryItemCheckedInEvent>(detail.Handle);
            bus.RegisterHandler<InventoryItemRemovedEvent>(detail.Handle);
            var list = new InventoryListView();
            bus.RegisterHandler<InventoryItemCreatedEvent>(list.Handle);
            bus.RegisterHandler<InventoryItemRenamedEvent>(list.Handle);
            bus.RegisterHandler<InventoryItemDeactivatedEvent>(list.Handle);
            ServiceLocator.Bus = bus;
        }
예제 #11
0
 public When_publishing_an_event_to_the_fakebus_with_a_single_event_handler_registered()
 {
     _bus = new FakeBus();
     _bus.RegisterHandler <TestEvent>(_handler.Handle);
 }
예제 #12
0
        public ServiceLocator()
        {
            Bus = new FakeBus();
            var storage  = new EventStore(Bus);
            var rep      = new Repository <InventoryItem>(storage);
            var commands = new InventoryCommandHandlers(rep);

            Bus.RegisterHandler <CheckInItemsToInventory>(commands.Handle);
            Bus.RegisterHandler <CreateInventoryItem>(commands.Handle);
            Bus.RegisterHandler <DeactivateInventoryItem>(commands.Handle);
            Bus.RegisterHandler <RemoveItemsFromInventory>(commands.Handle);
            Bus.RegisterHandler <RenameInventoryItem>(commands.Handle);
            var detail = new InventoryItemDetailView();

            Bus.RegisterHandler <InventoryItemCreated>(detail.Handle);
            Bus.RegisterHandler <InventoryItemDeactivated>(detail.Handle);
            Bus.RegisterHandler <InventoryItemRenamed>(detail.Handle);
            Bus.RegisterHandler <ItemsCheckedInToInventory>(detail.Handle);
            Bus.RegisterHandler <ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryListView();

            Bus.RegisterHandler <InventoryItemCreated>(list.Handle);
            Bus.RegisterHandler <InventoryItemRenamed>(list.Handle);
            Bus.RegisterHandler <InventoryItemDeactivated>(list.Handle);
        }
예제 #13
0
        protected void Application_Start(object sender, EventArgs e)
        {
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            MvcConfig.RegisterRoutes(RouteTable.Routes);
            MvcConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            _bus.RegisterHandler <CheckInItemsToInventory>(commands.Handle);
            _bus.RegisterHandler <CreateInventoryItem>(commands.Handle);
            _bus.RegisterHandler <DeactivateInventoryItem>(commands.Handle);
            _bus.RegisterHandler <RemoveItemsFromInventory>(commands.Handle);
            _bus.RegisterHandler <RenameInventoryItem>(commands.Handle);
            var detail = new InvenotryItemDetailView();

            _bus.RegisterHandler <InventoryItemCreated>(detail.Handle);
            _bus.RegisterHandler <InventoryItemDeactivated>(detail.Handle);
            _bus.RegisterHandler <InventoryItemRenamed>(detail.Handle);
            _bus.RegisterHandler <ItemsCheckedInToInventory>(detail.Handle);
            _bus.RegisterHandler <ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryListView();

            _bus.RegisterHandler <InventoryItemCreated>(list.Handle);
            _bus.RegisterHandler <InventoryItemRenamed>(list.Handle);
            _bus.RegisterHandler <InventoryItemDeactivated>(list.Handle);
        }
        public void BootStrapTheApplication()
        {
            EventStoreDatabaseBootStrapper.BootStrap();
            ReportingDatabaseBootStrapper.BootStrap();

            var bus = new FakeBus();
            ServiceLocator.Bus = bus;
            //var storage = new InMemoryEventStore(bus);
            //var storage = new NHibernateSqliteEventStore(bus, NHibernateSessionHelper.CreateSessionFactory(), new BinaryFormatter());
            var storage = new SqliteEventStore(bus, new BinaryFormatter(), "Data Source=eventStore.db3");

            var rep = new DomainRepository<InventoryItem>(storage);
            var commands = new InventoryCommandHandlers(rep);
            bus.RegisterHandler<CheckInItemsToInventory>(commands.Handle);
            bus.RegisterHandler<CreateInventoryItem>(commands.Handle);
            bus.RegisterHandler<DeactivateInventoryItem>(commands.Handle);
            bus.RegisterHandler<RemoveItemsFromInventory>(commands.Handle);
            bus.RegisterHandler<RenameInventoryItem>(commands.Handle);

            var sqlInsertBuilder = new SqlInsertBuilder();
            var sqlSelectBuilder = new SqlSelectBuilder();
            var sqlUpdateBuilder = new SqlUpdateBuilder();
            var sqlDeleteBuilder = new SqlDeleteBuilder();
            var reportingRepository = new SQLiteReportingRepository("Data Source=reportingDataBase.db3", sqlSelectBuilder,
                                                                    sqlInsertBuilder, sqlUpdateBuilder, sqlDeleteBuilder);
            var detail = new InventoryItemDetailViewHandler(reportingRepository);
            ServiceLocator.ReportingRepository = reportingRepository;
            bus.RegisterHandler<InventoryItemCreated>(detail.Handle);
            bus.RegisterHandler<InventoryItemDeactivated>(detail.Handle);
            bus.RegisterHandler<InventoryItemRenamed>(detail.Handle);
            bus.RegisterHandler<ItemsCheckedInToInventory>(detail.Handle);
            bus.RegisterHandler<ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryItemListViewHandler(reportingRepository);
            bus.RegisterHandler<InventoryItemCreated>(list.Handle);
            bus.RegisterHandler<InventoryItemRenamed>(list.Handle);
            bus.RegisterHandler<InventoryItemDeactivated>(list.Handle);
        }
예제 #15
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var bus = new FakeBus();

            var storage  = new EventStore(bus);
            var rep      = new Repository <InventoryItemAggregateRoot>(storage);
            var commands = new InventoryItemCommandHandlers(rep);

            bus.RegisterHandler <InventoryItemCheckInCommand>(commands.Handle);
            bus.RegisterHandler <InventoryItemCreateCommand>(commands.Handle);
            bus.RegisterHandler <InventoryItemDeactivateCommand>(commands.Handle);
            bus.RegisterHandler <InventoryItemRemoveCommand>(commands.Handle);
            bus.RegisterHandler <InventoryItemRenameCommand>(commands.Handle);
            var detail = new InventoryItemDetailView();

            bus.RegisterHandler <InventoryItemCreatedEvent>(detail.Handle);
            bus.RegisterHandler <InventoryItemDeactivatedEvent>(detail.Handle);
            bus.RegisterHandler <InventoryItemRenamedEvent>(detail.Handle);
            bus.RegisterHandler <InventoryItemCheckedInEvent>(detail.Handle);
            bus.RegisterHandler <InventoryItemRemovedEvent>(detail.Handle);
            var list = new InventoryListView();

            bus.RegisterHandler <InventoryItemCreatedEvent>(list.Handle);
            bus.RegisterHandler <InventoryItemRenamedEvent>(list.Handle);
            bus.RegisterHandler <InventoryItemDeactivatedEvent>(list.Handle);
            ServiceLocator.Bus = bus;
        }
예제 #16
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews();

            var bus      = new FakeBus();
            var storage  = new EventStore(bus);
            var rep      = new Repository <InventoryItem>(storage);
            var commands = new InventoryCommandHandlers(rep);

            bus.RegisterHandler <CheckInItemsToInventory>(commands.Handle);
            bus.RegisterHandler <CreateInventoryItem>(commands.Handle);
            bus.RegisterHandler <DeactivateInventoryItem>(commands.Handle);
            bus.RegisterHandler <RemoveItemsFromInventory>(commands.Handle);
            bus.RegisterHandler <RenameInventoryItem>(commands.Handle);
            var detail = new InventoryItemDetailView();

            bus.RegisterHandler <InventoryItemCreated>(detail.Handle);
            bus.RegisterHandler <InventoryItemDeactivated>(detail.Handle);
            bus.RegisterHandler <InventoryItemRenamed>(detail.Handle);
            bus.RegisterHandler <ItemsCheckedInToInventory>(detail.Handle);
            bus.RegisterHandler <ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryListView();

            bus.RegisterHandler <InventoryItemCreated>(list.Handle);
            bus.RegisterHandler <InventoryItemRenamed>(list.Handle);
            bus.RegisterHandler <InventoryItemDeactivated>(list.Handle);
            ServiceLocator.Bus = bus;
        }
예제 #17
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var bus = new FakeBus();

            var storage = new EventStore(bus);

            bus.RegisterHandler <CheckInItemsToInventoryCommand>(new CheckInItemsToInventoryCommandHandler(storage).Handle);
            bus.RegisterHandler <CreateInventoryCommand>(new CreateInventoryCommandHandler(storage).Handle);
            bus.RegisterHandler <DeactivateInventoryCommand>(new DeactivateInventoryCommandHandler(storage).Handle);
            bus.RegisterHandler <RemoveItemsFromInventoryCommand>(new RemoveItemsFromInventoryCommandHandler(storage).Handle);
            bus.RegisterHandler <RenameInventoryCommand>(new RenameInventoryCommandHandler(storage).Handle);

            var detailsView = new InventoryDetailsView();

            bus.RegisterHandler <Inventory.Events.Created>(detailsView.Handle);
            bus.RegisterHandler <Inventory.Events.Deactivated>(detailsView.Handle);
            bus.RegisterHandler <Inventory.Events.Renamed>(detailsView.Handle);
            bus.RegisterHandler <Inventory.Events.CheckedInToInventory>(detailsView.Handle);
            bus.RegisterHandler <Inventory.Events.RemovedFromInventory>(detailsView.Handle);

            var listView = new InventoriesView();

            bus.RegisterHandler <Inventory.Events.Created>(listView.Handle);
            bus.RegisterHandler <Inventory.Events.Renamed>(listView.Handle);
            bus.RegisterHandler <Inventory.Events.Deactivated>(listView.Handle);
            ServiceLocator.Bus = bus;
        }
예제 #18
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var bus = new FakeBus();

            var storage = new EventStore(bus);
            var rep = new Repository<InventoryItem>(storage);
            var commands = new InventoryCommandHandlers(rep);
            bus.RegisterHandler<CheckInItemsToInventory>(commands.Handle);
            bus.RegisterHandler<CreateInventoryItem>(commands.Handle);
            bus.RegisterHandler<DeactivateInventoryItem>(commands.Handle);
            bus.RegisterHandler<RemoveItemsFromInventory>(commands.Handle);
            bus.RegisterHandler<RenameInventoryItem>(commands.Handle);
            var detail = new InvenotryItemDetailView();
            bus.RegisterHandler<InventoryItemCreated>(detail.Handle);
            bus.RegisterHandler<InventoryItemDeactivated>(detail.Handle);
            bus.RegisterHandler<InventoryItemRenamed>(detail.Handle);
            bus.RegisterHandler<ItemsCheckedInToInventory>(detail.Handle);
            bus.RegisterHandler<ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryListView();
            bus.RegisterHandler<InventoryItemCreated>(list.Handle);
            bus.RegisterHandler<InventoryItemRenamed>(list.Handle);
            bus.RegisterHandler<InventoryItemDeactivated>(list.Handle);
            ServiceLocator.Bus = bus;
        }
예제 #19
0
 public When_sending_a_command_to_the_fakebus_with_multiple_command_handlers()
 {
     _bus = new FakeBus();
     _bus.RegisterHandler <TestCommand>(_handler.Handle);
 }