Пример #1
0
        public override async Task <ListResponse> LoadBatch(LoadBatchRequest request, ServerCallContext context)
        {
            var messages = await _mediator.Send(new MessageByIdBatchQuery(request.Id));

            var response = new ListResponse();

            response.Messages.Add(messages.Select(ToResponse));
            return(response);
        }
Пример #2
0
        public override async Task <ListResponse> LoadBatch(LoadBatchRequest request, ServerCallContext context)
        {
            using (var scope = _scopeFactory.CreateScope())
            {
                var mediator = scope.ServiceProvider.GetRequiredService <IMediator>();
                var messages = await mediator.Send(new MessageByIdBatchQuery(request.Id));

                var response = new ListResponse();
                response.Messages.Add(messages.Select(ToResponse));
                return(response);
            }
        }