public Cart(CartCreatedEvent cartCreatedEvent) { if (cartCreatedEvent == null) { throw new ArgumentNullException(nameof(cartCreatedEvent)); } Version = 1; UserId = cartCreatedEvent.UserId; }
public async Task <Cart> Handle(Query query, CancellationToken cancellationToken) { var cart = await cartsRepository.GetByUserId(query.UserId); if (cart == null) { var cartCreatedEvent = new CartCreatedEvent(query.UserId); cart = new Cart(cartCreatedEvent); } throw new Exception(); }
private void Handle(CartCreatedEvent evnt) { _userId = evnt.UserId; _cartGoodses = new List<CartGoods>(); }
internal void Apply(CartCreatedEvent ev) { Id = ev.AggregateId; CustomerId = ev.CustomerId; }