protected LightweightProxyBase(LightweightProxyArgs proxyArgs, LightweightMethodDef[] proxyMethods) : base(proxyArgs, proxyMethods) { this.connection = proxyArgs.Channel; this.callTimeout = ((int?)this.connection.Options.CallTimeout?.TotalMilliseconds) ?? 0; this.streamingCallTimeout = ((int?)this.connection.Options.StreamingCallTimeout?.TotalMilliseconds) ?? 0; this.methodSerializersCache = proxyArgs.MethodSerializersCache; this.CallInterceptors = proxyArgs.CallInterceptors.ToImmutableArray(); }
internal LightweightProxyArgs( LightweightRpcConnection connection, IReadOnlyList <RpcClientCallInterceptor> callInterceptors, RpcObjectId objectId, IRpcSerializer serializer, LightweightSerializersCache methodSerializersCache, IReadOnlyCollection <string>?implementedServices, SynchronizationContext?syncContext) : base(connection, objectId, serializer, implementedServices, syncContext) { this.MethodSerializersCache = methodSerializersCache; this.CallInterceptors = callInterceptors; }
private LightweightSerializersCache GetMethodSerializersCache(IRpcSerializer serializer) { lock (this.syncRoot) { if (this.serializerToMethodSerializersCache.TryGetValue(serializer, out var existingMethodsCache)) { return(existingMethodsCache); } var methodsCache = new LightweightSerializersCache(serializer); this.serializerToMethodSerializersCache.Add(serializer, methodsCache); return(methodsCache); } }