/// <summary> /// Creates the RPC method description. /// </summary> /// <typeparam name="TRequest">The type of the request.</typeparam> /// <typeparam name="TResponse">The type of the response.</typeparam> /// <param name="serviceName">The service name.</param> /// <param name="methodName">The method name.</param> /// <param name="methodType">The RPC method type.</param> /// <param name="marshallerFactory">The factory of the marshaller.</param> /// <returns>The method description.</returns> private static Method <TRequest, TResponse> CreateMethod <TRequest, TResponse>(string serviceName, string methodName, MethodType methodType, IRpcMarshallerFactory marshallerFactory) { return(new Method <TRequest, TResponse>(methodType, serviceName, methodName, marshallerFactory.GetMarshaller <TRequest>(), marshallerFactory.GetMarshaller <TResponse>())); }
/// <summary> /// Creates the RPC method description. /// </summary> /// <typeparam name="TRequest">The type of the request.</typeparam> /// <typeparam name="TResponse">The type of the response.</typeparam> /// <param name="builder">The service builder.</param> /// <param name="serviceName">The service name.</param> /// <param name="handler">The method information.</param> /// <param name="marshallerFactory">The factory of the marshaller.</param> /// <param name="serviceInstance">The service instance.</param> /// <returns>The method description.</returns> private static ServerServiceDefinition.Builder AddStructMethodCore <TRequest, TResponse>(ServerServiceDefinition.Builder builder, string serviceName, RpcMethodHandlerInfo handler, IRpcMarshallerFactory marshallerFactory, object serviceInstance) { Method <TRequest, TResponse> method = new Method <TRequest, TResponse>(handler.MethodType, serviceName, handler.Handler.Name, marshallerFactory.GetMarshaller <TRequest>(), marshallerFactory.GetMarshaller <TResponse>()); switch (handler.MethodType) { case MethodType.Unary: return(builder.AddStructMethod(method, (StructUnaryServerMethod <TRequest, TResponse>)handler.Handler.CreateDelegate(typeof(StructUnaryServerMethod <TRequest, TResponse>), serviceInstance))); case MethodType.ClientStreaming: return(builder.AddStructMethod(method, (StructClientStreamingServerMethod <TRequest, TResponse>)handler.Handler.CreateDelegate(typeof(StructClientStreamingServerMethod <TRequest, TResponse>), serviceInstance))); case MethodType.ServerStreaming: return(builder.AddStructMethod(method, (StructServerStreamingServerMethod <TRequest, TResponse>)handler.Handler.CreateDelegate(typeof(StructServerStreamingServerMethod <TRequest, TResponse>), serviceInstance))); case MethodType.DuplexStreaming: return(builder.AddStructMethod(method, (StructDuplexStreamingServerMethod <TRequest, TResponse>)handler.Handler.CreateDelegate(typeof(StructDuplexStreamingServerMethod <TRequest, TResponse>), serviceInstance))); default: return(builder); } }
/// <summary> /// Creates the RPC method description. /// </summary> /// <typeparam name="TRequest">The type of the request.</typeparam> /// <typeparam name="TResponse">The type of the response.</typeparam> /// <param name="serviceName">The service name.</param> /// <param name="handler">The method information.</param> /// <param name="marshallerFactory">The factory of the marshaller.</param> /// <returns>The method description.</returns> private static Method <TRequest, TResponse> CreateMethodCore <TRequest, TResponse>(string serviceName, RpcMethodHandlerInfo handler, IRpcMarshallerFactory marshallerFactory) { return(new Method <TRequest, TResponse>(handler.MethodType, serviceName, handler.Handler.Name, marshallerFactory.GetMarshaller <TRequest>(), marshallerFactory.GetMarshaller <TResponse>())); }