/// <summary> /// Free, release, or reset managed or unmanaged resources. /// </summary> /// <param name="disposing">Wether to free, release, or resetting unmanaged resources or not.</param> protected override void Dispose(bool disposing) { if (_disposed) { Profiler.OnError("Connection already disposed!"); } if (disposing && WrappedConnection != null) { if (State != ConnectionState.Closed) { Close(); } WrappedConnection.StateChange -= StateChangeHandler; WrappedConnection.Dispose(); } _disposed = true; WrappedConnection = null; Profiler = null; // corefx calls Close() in Dispose() without checking ConnectionState. #if !NETSTANDARD1_6 base.Dispose(disposing); #endif }
/// <summary> /// Free, release, or reset managed or unmanaged resources. /// </summary> /// <param name="disposing">Wether to free, release, or resetting unmanaged resources or not.</param> protected override void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (!_leaveOpen) { if (WrappedConnection != null) { if (State != ConnectionState.Closed) { Close(); } WrappedConnection.StateChange -= StateChangeHandler; WrappedConnection.Dispose(); } WrappedConnection = null; } Profiler = null; } // corefx calls Close() in Dispose() without checking ConnectionState. #if !NETSTANDARD1_6 base.Dispose(disposing); #endif _disposed = true; }
protected override void Dispose(bool disposing) { if (disposing) { WrappedConnection.Dispose(); } base.Dispose(disposing); }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { WrappedConnection.Dispose(); } _disposedValue = true; } }
/// <summary> /// Free, release, or reset managed or unmanaged resources. /// </summary> /// <param name="disposing">Wether to free, release, or resetting unmanaged resources or not.</param> protected override void Dispose(bool disposing) { if (disposing && WrappedConnection != null) { if (State != ConnectionState.Closed) { Close(); } WrappedConnection.StateChange -= StateChangeHandler; WrappedConnection.Dispose(); } WrappedConnection = null; Profiler = null; // corefx calls Close() in Dispose() without checking ConnectionState. #if !COREFX base.Dispose(disposing); #endif }