internal LightweightSerializers <TRequest, TResponse> GetSerializers <TRequest, TResponse>(RpcProxyMethod proxyMethod) where TRequest : class where TResponse : class { lock (this.syncRoot) { if (this.proxyToSerializers.TryGetValue(proxyMethod, out var serializers)) { return((LightweightSerializers <TRequest, TResponse>)serializers); } var newSerializers = new LightweightSerializers <TRequest, TResponse>(this.serializer); this.proxyToSerializers.Add(proxyMethod, newSerializers); return(newSerializers); } }
internal GrpcCore.Method <TRequest, TResponse> GetGrpcMethod <TRequest, TResponse>(RpcProxyMethod proxyMethod) where TRequest : class where TResponse : class { lock (this.syncRoot) { if (this.proxyToGrpcMethod.TryGetValue(proxyMethod, out var grpcMethod)) { return((GrpcCore.Method <TRequest, TResponse>)grpcMethod); } var newGrpcMethod = ((GrpcProxyMethod <TRequest, TResponse>)proxyMethod).CreateMethod(this.serializer); this.proxyToGrpcMethod.Add(proxyMethod, newGrpcMethod); return(newGrpcMethod); } }