Beispiel #1
0
 public Application(IShoppingCartContext shoppingCartContext,
                    ICommandDispatcher commandDispatcher,
                    IEventObserver eventObserver)
 {
     this.eventObserver     = eventObserver;
     ShoppingCartContext    = shoppingCartContext;
     this.commandDispatcher = commandDispatcher;
 }
Beispiel #2
0
        private void SetupEnvironment()
        {
            var configs = new MongoDbConfigurations()
            {
                Host     = "test",
                Port     = 27017,
                Database = "TestDB"
            };

            _context = new ShoppingCartContext(configs);
        }
Beispiel #3
0
        private void RegisterHandlerFactories(IEventStore eventStore, ICommandDispatcher dispatcher,
                                              IShoppingCartContext shoppingCartContext)
        {
            RegisterHandlerFactoryWithTypes(
                () => new ShoppingCartEventHandler(shoppingCartContext),
                typeof(CartCreated),
                typeof(ProductAddedToCart),
                typeof(ProductRemovedFromCart),
                typeof(CartEmptied),
                typeof(CartCheckedOut));

            RegisterHandlerFactoryWithTypes(
                () => new OrderEventHandler(new Repository(eventStore), dispatcher),
                typeof(OrderCreated),
                typeof(PaymentReceived),
                typeof(ShippingAddressConfirmed));
        }
        private void SetupEnvironment()
        {
            var dbGuid = new Guid();

            var configs = new MongoDbConfigurations()
            {
                Database = dbGuid.ToString(),
                Host     = "localhost",
                Port     = 27017,
                User     = "******",
                Password = "******"
            };

            _context = new ShoppingCartContext(configs);

            _itemRepository = new ItemRepository(_context);
        }
 public ItemRepository(IShoppingCartContext context)
     : base(context)
 {
 }
Beispiel #6
0
 public EventHandlerFactory(IEventStore eventStore,
                            ICommandDispatcher dispatcher,
                            IShoppingCartContext shoppingCartContext)
 {
     RegisterHandlerFactories(eventStore, dispatcher, shoppingCartContext);
 }
 protected CrudRepository(IShoppingCartContext context)
 {
     _mongoContext = context;
     _dbCollection = _mongoContext.GetCollection <TEntity>(typeof(TEntity).Name);
 }
 public ShoppingCartRepository(IShoppingCartContext context)
 {
     _context = context;
 }
Beispiel #9
0
 public ShoppingCartProvider(IShoppingCartContext db)
 {
     _db        = db;
     _dbContext = _db.GetDbContext();
 }
Beispiel #10
0
 public ShoppingCartRepository(IShoppingCartContext shoppingCartContext)
 {
     _shoppingCartContext = shoppingCartContext;
 }
 public ShoppingCartEventHandler(IShoppingCartContext context)
 {
     this.context = context;
 }