public async Task AddAsync(Guid id, string message, CancellationToken cancellationToken = new CancellationToken()) { using (var uow = new GreetingContext(_options)) { var repository = new GreetingRepositoryAsync(uow); var savedItem = await repository.AddAsync(new Greeting { Id = id, Message = message }, cancellationToken); } }
public override async Task <AddGreetingCommand> HandleAsync(AddGreetingCommand command, CancellationToken cancellationToken = new CancellationToken()) { using (var uow = new GreetingContext(_options)) { var repository = new GreetingRepositoryAsync(uow); var savedItem = await repository.AddAsync( new Greeting { Id = command.Id, Message = command.Message }, cancellationToken ); } return(await base.HandleAsync(command, cancellationToken)); }