private bool AddMethod <TService, TRequest, TResponse>( string serviceName, string operationName, MethodInfo method, MethodType methodType, object state, Func <MethodInfo, Expression[], Expression>?invoker, MarshallerCache marshallerCache, ConstantExpression?service) where TService : class where TRequest : class where TResponse : class { var grpcMethod = new Method <TRequest, TResponse>(methodType, serviceName, operationName, marshallerCache.GetMarshaller <TRequest>(), marshallerCache.GetMarshaller <TResponse>()); var stub = new MethodStub <TService>(invoker, method, service); return(TryBind <TService, TRequest, TResponse>(state, grpcMethod, stub)); }
private bool AddMethod <TService, TRequest, TResponse>( string serviceName, string operationName, MethodInfo method, MethodType methodType, ServiceBindContext bindContext, Func <MethodInfo, Expression[], Expression>?invoker, MarshallerCache marshallerCache, ConstantExpression?service) where TService : class where TRequest : class where TResponse : class { var grpcMethod = new Method <TRequest, TResponse>(methodType, serviceName, operationName, marshallerCache.GetMarshaller <TRequest>(), marshallerCache.GetMarshaller <TResponse>()); var stub = new MethodStub <TService>(invoker, method, service); try { return(TryBind <TService, TRequest, TResponse>(bindContext, grpcMethod, stub)); } catch (Exception ex) { OnError(ex.Message); return(false); } }
private BinderConfiguration(MarshallerFactory[] factories, ServiceBinder binder) { MarshallerCache = new MarshallerCache(factories); Binder = binder; }