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));
 }
Exemplo n.º 3
0
        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> >()));
        }