/// <summary> /// メソッド定義を生成します。 /// </summary> /// <typeparam name="TRequest">リクエストの型</typeparam> /// <typeparam name="TResponse">レスポンスの型</typeparam> /// <param name="serviceName">サービス名</param> /// <param name="handler">メソッドハンドラ情報</param> /// <param name="marshallerFactory">マーシャラーの生成処理</param> /// <returns>メソッド定義</returns> private static Method <TRequest, TResponse> CreateMethodCore <TRequest, TResponse>(string serviceName, GrpcMethodHandlerInfo handler, IGrpcMarshallerFactory marshallerFactory) { return(new Method <TRequest, TResponse>(handler.MethodType, serviceName, handler.Handler.Name, marshallerFactory.GetMarshaller <TRequest>(), marshallerFactory.GetMarshaller <TResponse>())); }
/// <summary> /// メソッド定義を生成します。 /// </summary> /// <param name="serviceName">サービス名</param> /// <param name="handler">メソッドハンドラ情報</param> /// <param name="marshallerFactory">マーシャラーの生成処理</param> /// <returns>メソッド定義</returns> public static IMethod CreateMethod(string serviceName, GrpcMethodHandlerInfo handler, IGrpcMarshallerFactory marshallerFactory) { MethodInfo m = typeof(GrpcReflection).GetMethod("CreateMethodCore", BindingFlags.Static | BindingFlags.NonPublic); return((IMethod)m.MakeGenericMethod(new Type[] { handler.RequestType, handler.ResponseType }).Invoke(null, new object[] { serviceName, handler, marshallerFactory })); }