/// <summary> /// Creates a new instance of <see cref="ServerMethodInvokerBase{TService, TRequest, TResponse}"/>. /// </summary> /// <param name="method">The description of the gRPC method.</param> /// <param name="options">The options used to execute the method.</param> /// <param name="serviceActivator">The service activator used to create service instances.</param> private protected ServerMethodInvokerBase( Method <TRequest, TResponse> method, MethodOptions options, IGrpcServiceActivator <TService> serviceActivator) { Method = method; Options = options; ServiceActivator = serviceActivator; }
/// <summary> /// Creates a new instance of <see cref="ClientStreamingServerMethodInvoker{TService, TRequest, TResponse}"/>. /// </summary> /// <param name="invoker">The client streaming method to invoke.</param> /// <param name="method">The description of the gRPC method.</param> /// <param name="options">The options used to execute the method.</param> /// <param name="serviceActivator">The service activator used to create service instances.</param> public ClientStreamingServerMethodInvoker( ClientStreamingServerMethod <TService, TRequest, TResponse> invoker, Method <TRequest, TResponse> method, MethodOptions options, IGrpcServiceActivator <TService> serviceActivator) : base(method, options, serviceActivator) { _invoker = invoker; if (Options.HasInterceptors) { var interceptorPipeline = new InterceptorPipelineBuilder <TRequest, TResponse>(Options.Interceptors); _pipelineInvoker = interceptorPipeline.ClientStreamingPipeline(ResolvedInterceptorInvoker); } }
private static HttpApiServerCallContext CreateServerCallContext(DefaultHttpContext httpContext) { return(new HttpApiServerCallContext( httpContext, MethodOptions.Create(Enumerable.Empty <GrpcServiceOptions>()), new Method <object, object>( MethodType.Unary, "Server", "Method", new Marshaller <object>(o => null, c => null !), new Marshaller <object>(o => null, c => null !)), new CallHandlerDescriptorInfo( null, null, false, null, new Dictionary <string, List <FieldDescriptor> >()), NullLogger.Instance)); }
private static JsonTranscodingServerCallContext CreateServerCallContext(DefaultHttpContext httpContext) { return(new JsonTranscodingServerCallContext( httpContext, MethodOptions.Create(Enumerable.Empty <GrpcServiceOptions>()), new Method <object, object>( MethodType.Unary, "Server", "Method", new Marshaller <object>(o => null !, c => null !), new Marshaller <object>(o => null !, c => null !)), new CallHandlerDescriptorInfo( null, null, false, null, new Dictionary <string, List <FieldDescriptor> >(), JsonTranscodingRouteAdapter.Parse(HttpRoutePattern.Parse("/") !)), NullLogger.Instance)); }
private static UnaryServerCallHandler <HttpApiGreeterService, HelloRequest, HelloReply> CreateCallHandler( UnaryServerMethod <HttpApiGreeterService, HelloRequest, HelloReply> invoker, FieldDescriptor?responseBodyDescriptor = null, Dictionary <string, List <FieldDescriptor> >?routeParameterDescriptors = null, MessageDescriptor?bodyDescriptor = null, bool?bodyDescriptorRepeated = null, List <FieldDescriptor>?bodyFieldDescriptors = null) { var unaryServerCallInvoker = new UnaryServerMethodInvoker <HttpApiGreeterService, HelloRequest, HelloReply>( invoker, CreateServiceMethod <HelloRequest, HelloReply>("TestMethodName", HelloRequest.Parser, HelloReply.Parser), MethodOptions.Create(new[] { new GrpcServiceOptions() }), new TestGrpcServiceActivator <HttpApiGreeterService>()); return(new UnaryServerCallHandler <HttpApiGreeterService, HelloRequest, HelloReply>( unaryServerCallInvoker, responseBodyDescriptor, bodyDescriptor, bodyDescriptorRepeated ?? false, bodyFieldDescriptors, routeParameterDescriptors ?? new Dictionary <string, List <FieldDescriptor> >())); }