Figaro - The XML Database for the .NET Framework
Deleting Indices
To delete an index from a container:
CopyC#
- Retrieve the index specification from the container.
- Use DeleteIndex to delete the index from the index specification.
- Set the updated index specification back to the container.
using System; using Figaro.BerkeleyDB.Xml; namespace Figaro.Documentation.Examples { class DeleteIndices { private const string baseUri = @"C:\dev\db\"; private const string testdb = "DeleteIndices.dbxml"; private const string testdata = @"C:\dev\db\xmlData\nsData\"; static void Main() { //get our manager using (var mgr = new XmlManager(ManagerInitOptions.AllowExternalAccess | ManagerInitOptions.AllowAutoOpen)) { prepareContainer(true); //open a container using (var container = mgr.OpenContainer(baseUri + testdb)) { try { XmlIndexSpecification spec = container.GetIndexSpecification(); spec.DeleteIndex("http://groceryItem.dbxml/fruits", "item", new IndexingStrategy("edge-element-equality-string")); container.SetIndexSpecification(spec, mgr.CreateUpdateContext()); } finally { container.Close(); } } } }