Esempio n. 1
0
 /// <inheritdoc/>
 public override async Task <Contracts.GetAllResponse> GetAll(Contracts.GetAllRequest request, ServerCallContext context)
 => CreateResponse <Contracts.GetAllResponse, IEnumerable <EmbeddingCurrentState> >(
     await _embeddingsService.TryGetAll(
         request.EmbeddingId.ToGuid(),
         request.CallContext.ExecutionContext.ToExecutionContext(),
         context.CancellationToken).ConfigureAwait(false),
     (result, response) => response.States.AddRange(result.ToProtobuf()),
     (failure, response) => response.Failure = failure);
Esempio n. 2
0
    /// <inheritdoc />
    public override Task <Contracts.GetAllResponse> GetAll(Contracts.GetAllRequest request, ServerCallContext context)
    {
        try
        {
            _logger.GetAllCalled();
            var response = new Contracts.GetAllResponse();

            response.Tenants.AddRange(_tenants.All.Select(ToProtobuf));
            return(Task.FromResult(response));
        }
        catch (Exception ex)
        {
            _logger.FailedToGetAll(ex);
            return(Task.FromResult(new Contracts.GetAllResponse {
                Failure = ex.ToProtobuf()
            }));
        }
    }