protected virtual void Dispose(bool disposing) { if (disposing) { if (_context != null) { _context.Dispose(); _context = null; } } }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { _context.Dispose(); } } disposed = true; }
private void Dispose(bool disposing) { if (disposing) { if (_context != null) { _context.Dispose(); _context = null; } } }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } if (_context == null) { return; } _context.Dispose(); _context = null; }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (_context != null) { _context.Dispose(); _context = null; } } disposedValue = true; } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_context != null) { _context.Dispose(); _context = null; } if (_cancellationTokenSource != null) { _cancellationTokenSource.Dispose(); _cancellationTokenSource = null; } } }
protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (context != null) { context.Dispose(); } if (cancellationTokenSource != null) { cancellationTokenSource.Dispose(); cancellationTokenSource = null; } } // TODO: free unmanaged resources (unmanaged objects) and override finalizer // TODO: set large fields to null disposedValue = true; } }
// Protected implementation of Dispose pattern. protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { if (booksContext != null) { booksContext.Dispose(); booksContext = null; } if (cancellationTokenSource != null) { cancellationTokenSource.Dispose(); cancellationTokenSource = null; } } disposed = true; }
public void Dispose() { _context?.Dispose(); }
public void Dispose() { _dbContext.Dispose(); }
public void Dispose() { _booksContext?.Dispose(); }
public void Dispose() { _data.Dispose(); }