public async Task HandleAsync(UserInfoCreateEvent @event, ICorrelationContext context) { var user = new Domain.UserInfo() { Name = @event.Name, Address = @event.Address, Age = @event.Age, }; await _repository.AddAsync(user); _logger.LogInformation($"Created customer with id: '{@event.Id}'."); }
public async Task HandleAsync(UserInfoCreateCommand command, ICorrelationContext context) { var userInfo = new UserInfo() { Id = command.Id, Name = command.Name, Address = command.Address, Age = command.Age }; await _repository.AddAsync(userInfo); await _busPublisher.PublishAsync(new UserInfoCreateEvent(command.Id, command.Name, command.Address, command.Age), context); }