/// <summary> /// Initializes a new instance of the QueryProviderProxy class. /// </summary> /// <param name="wrapperScope">The wrapper scope.</param> /// <param name="underlyingImplementation">The underlying implementation of the proxy.</param> public QueryProviderProxy(IWrapperScope wrapperScope, System.Linq.IQueryProvider underlyingImplementation) { ExceptionUtilities.CheckArgumentNotNull(wrapperScope, "wrapperScope"); ExceptionUtilities.CheckArgumentNotNull(underlyingImplementation, "underlyingImplementation"); this.Scope = wrapperScope; this.underlyingImplementation = underlyingImplementation; }
/// <summary> /// Disposes the wrapped instance if it implements IDisposable. /// </summary> /// <param name="disposing">Whether or not to dispose managed resources</param> protected virtual void Dispose(bool disposing) { CallOrderUtilities.TryWrapArbitraryMethodCall( () => this.Dispose(), () => { var d = this.underlyingImplementation as IDisposable; if (d != null) { d.Dispose(); this.underlyingImplementation = null; } }); }