/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { if (_disconnectReaderOnDispose && _reader != null && _reader.IsConnected) { _reader.Dispose(); } if (_releaseContextOnDispose && _context != null && _context.IsValid()) { _context.Dispose(); } } }
/// <summary> /// Actual disposing code, ensures the class is only disposed of once. /// </summary> /// <param name="disposing">Whether we are also disposing of related objects</param> private void Dispose(bool disposing) { if (disposed) { return; } if (disposing && Context != null) { Context.Dispose(); } if (disposing && Reader != null) { Reader.Dispose(); } disposed = true; }
public void Dispose() { _reader.Dispose(); }