public void GlobalCleanupInMemory() { _fileMetaInMemoryCollection = null; DatabaseInstanceInMemory.DropCollection(nameof(FileMetaBase)); DatabaseInstanceInMemory.Dispose(); File.Delete(DatabasePath); }
public void CleanUpInMemory() { const string collectionName = nameof(FileMetaBase); var droppedCollectionIndexes = DatabaseInstanceInMemory.GetCollection(collectionName).GetIndexes().ToList(); DatabaseInstanceInMemory.DropCollection(collectionName); foreach (var indexInfo in droppedCollectionIndexes) { DatabaseInstanceInMemory.Engine.EnsureIndex(collectionName, indexInfo.Field, indexInfo.Expression); } }