public object CreateInstance(JsonRpcClient client, IJsonRpcRequestMarshaler marshaler) { var realProxy = _LastRealProxy; if (realProxy == null || realProxy.Client != client || realProxy.MethodTable != MethodTable || realProxy.Marshaler != marshaler) { realProxy = new JsonRpcRealProxy(client, MethodTable, marshaler); Volatile.Write(ref _LastRealProxy, realProxy); } return(Activator.CreateInstance(ProxyType, realProxy)); }
internal JsonRpcRealProxy(JsonRpcClient client, IList <JsonRpcMethod> methodTable, IJsonRpcRequestMarshaler marshaler) { this.Client = client ?? throw new ArgumentNullException(nameof(client)); this.MethodTable = methodTable ?? throw new ArgumentNullException(nameof(methodTable)); this.Marshaler = marshaler ?? throw new ArgumentNullException(nameof(marshaler)); }