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);
        }
コード例 #2
0
        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);
        }