Пример #1
0
        public void Submit()
        {
            if (HasEnded)
            {
                throw new ObjectDisposedException("Unit of Work has been disposed.");
            }

            if (_context != null)
            {
                _rules.ApplyInsertRules(_context.Changes(EntityState.Added));
                _rules.ApplyDeleteRules(_context.Changes(EntityState.Modified));
                _rules.ApplyUpdateRules(_context.Changes(EntityState.Deleted));

                _context.SaveChanges();
            }
        }