public async Task Handle(CreateOrderCommand command) { var aggregateId = new OrderAggregateId(); var order = new OrderAggregate(aggregateId, command.customerId, command.orderDate, command.orderStatus); IDomainEventPublisher <OrderAggregateId> publisher = new InMemoryDomainEventPublisher <OrderAggregateId>(); IWriteRepository <OrderAggregate, OrderAggregateId> repo = new InMemoryWriteRepository <OrderAggregate, OrderAggregateId>(publisher); await repo.SaveAsync(order); }
public async Task Handle(CreateOrderCommand command) { var aggregateId = new OrderAggregateId(); var order = new OrderAggregate(aggregateId, command.customerId, command.orderDate, command.orderStatus); IDomainEventPublisher <OrderAggregateId> publisher = new InMemoryDomainEventPublisher <OrderAggregateId>(); IWriteRepository <OrderAggregate, OrderAggregateId> repo = new InMemoryWriteRepository <OrderAggregate, OrderAggregateId>(publisher); await repo.SaveAsync(order); // foreach (var pe in InMemoryPersistance.publishedEvents) Helpers.SimpleLogger.Log(pe.ToString()); }