/// <summary> /// Construct a proxy object, if called directly, it does not implement the contract. /// It is recommended you extend this class, or use ProxyGenerator to generate the proxy object /// if you want that behavior /// </summary> /// <param name="contract">The contract this proxy is using.</param> /// <param name="id">The id of the proxy object.</param> /// <param name="handler">The handler for this object, it is responsible for relaying execution request to the real object</param> public ProxyObject(Type contract, long id, IProxyHandler handler) { if (handler == null) { throw new ArgumentNullException(nameof(handler)); } if (!handler.CheckProxy(id, contract)) { throw new InvalidOperationException("This proxy configuration is invalid!"); } ContractType = contract; _handler = handler; Id = id; }