Пример #1
0
        public static CommandHandlerFactory NewCommandHandlerFactory(Func <IRepository> repositoryProvider)
        {
            var commandHandlerFactor = new CommandHandlerFactory();

            commandHandlerFactor.RegisterFactory(
                () => new ShoppingCartCommandHandler(repositoryProvider()),
                typeof(CreateNewCart),
                typeof(AddProductToCart),
                typeof(RemoveProductFromCart),
                typeof(EmptyCart),
                typeof(Checkout));

            commandHandlerFactor.RegisterFactory(
                () => new OrderCommandHandler(repositoryProvider()),
                typeof(PlaceOrder),
                typeof(PayForOrder),
                typeof(ProvideShippingAddress),
                typeof(CompleteOrder));

            return(commandHandlerFactor);
        }
        public static CommandHandlerFactory NewCommandHandlerFactory(Func <IRepository> repositoryProvider)
        {
            var commandHandlerFactor = new CommandHandlerFactory();

            commandHandlerFactor.RegisterFactory(
                () => new ShipmentCommandHandler(repositoryProvider()),
                typeof(CreateShipment),
                typeof(StartShipment),
                typeof(DeliverShipment));

            return(commandHandlerFactor);
        }
        public static CommandHandlerFactory NewCommandHandlerFactory(Func <IRepository> repositoryProvider)
        {
            var commandHandlerFactor = new CommandHandlerFactory();

            commandHandlerFactor.RegisterFactory(
                () => new CustomerCommandHandler(repositoryProvider()),
                typeof(CreateNewCustomer),
                typeof(UpdateCustomer),
                typeof(RemoveCustomer));

            return(commandHandlerFactor);
        }