public virtual void Dispose(bool disposing) { if (!_disposed && disposing) { _context.Dispose(); foreach (IDisposable repository in repositories.Values) { repository.Dispose();// dispose all repositries } } _disposed = true; }
public void Dispose(bool disposing) { if (!_disposed && disposing) { _context.Dispose(); foreach (IDisposable repository in _repositories.Values) { repository.Dispose(); } } _disposed = true; }
protected virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { _context.Dispose(); Rollback(); } } this.disposed = true; }
public virtual void Dispose(bool disposing) { if (!_disposed && disposing) { _context.Dispose(); if (_repositories != null && _repositories.Values != null && _repositories.Values.OfType <IDisposable>().Any()) { foreach (IDisposable repository in _repositories.Values) { repository.Dispose();// dispose all repositries } } } _disposed = true; GC.SuppressFinalize(this); }
public virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { // free other managed objects that implement // IDisposable only try { if (_objectContext != null && _objectContext.Connection.State == ConnectionState.Open) { _objectContext.Connection.Close(); } } catch (ObjectDisposedException) { // do nothing, the objectContext has already been disposed } if (_context != null) { _context.Dispose(); _context = null; } _transaction?.Dispose(); } // release any unmanaged objects // set the object references to null _disposed = true; }