Esempio n. 1
0
 public UnaryServerCallHandler(
     UnaryServerMethodInvoker <TService, TRequest, TResponse> unaryMethodInvoker,
     FieldDescriptor?responseBodyDescriptor,
     MessageDescriptor?bodyDescriptor,
     bool bodyDescriptorRepeated,
     List <FieldDescriptor>?bodyFieldDescriptors,
     Dictionary <string, List <FieldDescriptor> > routeParameterDescriptors,
     GrpcHttpApiOptions httpApiOptions)
 {
     _unaryMethodInvoker     = unaryMethodInvoker;
     _responseBodyDescriptor = responseBodyDescriptor;
     _bodyDescriptor         = bodyDescriptor;
     _bodyDescriptorRepeated = bodyDescriptorRepeated;
     _bodyFieldDescriptors   = bodyFieldDescriptors;
     if (_bodyFieldDescriptors != null)
     {
         _bodyFieldDescriptorsPath = string.Join('.', _bodyFieldDescriptors.Select(d => d.Name));
     }
     if (_bodyDescriptorRepeated && _bodyFieldDescriptors != null)
     {
         _resolvedBodyFieldDescriptors = _bodyFieldDescriptors.Take(_bodyFieldDescriptors.Count - 1).ToList();
     }
     _routeParameterDescriptors = routeParameterDescriptors;
     _jsonFormatter             = httpApiOptions.JsonFormatter;
     _jsonParser           = httpApiOptions.JsonParser;
     _pathDescriptorsCache = new ConcurrentDictionary <string, List <FieldDescriptor>?>(StringComparer.Ordinal);
 }
 public HttpApiServiceMethodProvider(
     ILoggerFactory loggerFactory,
     IOptions <GrpcServiceOptions> globalOptions,
     IOptions <GrpcServiceOptions <TService> > serviceOptions,
     IServiceProvider serviceProvider,
     IGrpcServiceActivator <TService> serviceActivator,
     IOptions <GrpcHttpApiOptions> httpApiOptions)
 {
     _logger           = loggerFactory.CreateLogger <HttpApiServiceMethodProvider <TService> >();
     _globalOptions    = globalOptions.Value;
     _serviceOptions   = serviceOptions.Value;
     _httpApiOptions   = httpApiOptions.Value;
     _loggerFactory    = loggerFactory;
     _serviceProvider  = serviceProvider;
     _serviceActivator = serviceActivator;
 }
 internal HttpApiProviderServiceBinder(
     ServiceMethodProviderContext <TService> context,
     Type declaringType,
     ServiceDescriptor serviceDescriptor,
     GrpcServiceOptions globalOptions,
     GrpcServiceOptions <TService> serviceOptions,
     IServiceProvider serviceProvider,
     ILoggerFactory loggerFactory,
     IGrpcServiceActivator <TService> serviceActivator,
     GrpcHttpApiOptions httpApiOptions)
 {
     _context           = context;
     _declaringType     = declaringType;
     _serviceDescriptor = serviceDescriptor;
     _globalOptions     = globalOptions;
     _serviceOptions    = serviceOptions;
     _serviceActivator  = serviceActivator;
     _httpApiOptions    = httpApiOptions;
     _logger            = loggerFactory.CreateLogger <HttpApiProviderServiceBinder <TService> >();
 }