public async Task Handle(CreateAddressCommandWithTransientDbContext command, CancellationToken cancellationToken) { var address = _mapper.Map <CreateAddressCommandWithTransientDbContext, Address>(command); _db.Create(address); command.Address = address; await _db.SaveChangesAsync(cancellationToken).ConfigureAwait(false); }
public async Task Handle(CreateCustomerCommandWithTransientDbContext command, CancellationToken cancellationToken) { var cust = _mapper.Map <CreateCustomerCommandWithTransientDbContext, Customer>(command); _db.Create(cust); command.Customer = cust; await _db.SaveChangesAsync(cancellationToken).ConfigureAwait(false); }