public void Dispose() { if (_isDisposed) { return; } _isDisposed = true; if (LoggerManager.Instance.StorageLogger != null && LoggerManager.Instance.StorageLogger.IsWarnEnabled) { LoggerManager.Instance.StorageLogger.Warn("Collection is being disposed. ", "DatabaseId = " + _parent.DbContext.DatabaseName + " collection = " + Name + " .Persistence operations discarded = " + _dirtyDocuments.Count); } if (_statsCollector != null) { _statsCollector.DecrementStatsValue(StatisticsType.PendingPersistentDocuments, _dirtyDocuments.Count); } if (_statsCollector != null) { _statsCollector.DecrementStatsValue(StatisticsType.CacheCount, _cache.Count); _statsCollector.DecrementStatsValue(StatisticsType.CacheSize, _cacheSize); } //if (_dirtyDocuments != null && _dirtyDocuments.Count>0) //{ // foreach (var pair in _dirtyDocuments) // { // lock (_unpersistedOperations) // { // _unpersistedOperations.Remove(pair.Key); // } // } // _dirtyDocuments.Clear(); //} if (_cacheSpace != null) { _cacheSpace.RemoveConsumer(this); } if (_cache != null) { _cache.Clear(); _cache = null; } if (_persistenceManager != null) { _persistenceManager.Dispose(); } if (_indexManager != null) { _indexManager.Dispose(); } }
public void Dispose() { _persistenceManager.Dispose(); }