protected override void DisposeInternal(bool disposing) { try { if (disposing) { foreach (DictionaryEntry entry in _contextData) { if (entry.Key is DbFactory) { var cmd = entry.Value as DbCommand; if (cmd != null) { cmd.Connection.Close(); cmd.Dispose(); } } } if (_transactionScope != null) { _transactionScope.Dispose(); } } // Indicate that the instance has been disposed. _contextData = null; } finally { //!Important _current = null; } }
private DbScope() { //!Important _current = this; _contextData = new ListDictionary(); }