private void DeleteTree(Tree tree, bool isInRoot = true) { foreach (var page in tree.AllPages()) { _lowLevelTransaction.FreePage(page); } if (isInRoot) { _lowLevelTransaction.RootObjects.Delete(tree.Name); } }
public void DeleteTree(Slice name) { if (_lowLevelTransaction.Flags == TransactionFlags.ReadWrite == false) { throw new ArgumentException("Cannot create a new newRootTree with a read only transaction"); } Tree tree = ReadTree(name); if (tree == null) { return; } foreach (var page in tree.AllPages()) { _lowLevelTransaction.FreePage(page); } _lowLevelTransaction.RootObjects.Delete(name); if (_multiValueTrees != null) { var toRemove = new List <Tuple <Tree, Slice> >(); foreach (var valueTree in _multiValueTrees) { var multiTree = valueTree.Key.Item1; if (SliceComparer.Equals(multiTree.Name, name)) { toRemove.Add(valueTree.Key); } } foreach (var recordToRemove in toRemove) { _multiValueTrees.Remove(recordToRemove); } } // already created in ReadTree _trees.Remove(name); }