コード例 #1
0
 public virtual void Dispose(bool disposing)
 {
     if (!_disposed && disposing)
     {
         _context.Dispose();
         foreach (IDisposable repository in repositories.Values)
         {
             repository.Dispose();// dispose all repositries
         }
     }
     _disposed = true;
 }
コード例 #2
0
 public void Dispose(bool disposing)
 {
     if (!_disposed && disposing)
     {
         _context.Dispose();
         foreach (IDisposable repository in _repositories.Values)
         {
             repository.Dispose();
         }
     }
     _disposed = true;
 }
コード例 #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    _context.Dispose();
                    Rollback();
                }
            }

            this.disposed = true;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: UnitOfWork.cs プロジェクト: afroukh/pocsaid
        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;
        }