Dim instance As NinjaDbPro Dim indexName As String instance.RemoveIndex(Of T)(indexName)
Parameters
- indexName
- The name of the index to remove
Type Parameters
- T
- The class type
Dim instance As NinjaDbPro Dim indexName As String instance.RemoveIndex(Of T)(indexName)
NinjaDbPro db = new NinjaDbPro("MyDatabaseDirectory", "MyDatabaseName"); //Licensed Mode //db.UserName = "John Smith 101224"; //db.LicenseKey = "aousdf832jasf=="; //Set before OpenDatabase. Default storage is IsolatedStorageDatabase. Other options are: //db.Storage = new MemoryDatabase(); //In memory database //db.Storage = new FileDatabase(); db.OpenDatabase(); db.AddIndex<Person>("Name", "Name", IndexStyle.NonUnique); Person person1 = new Person(); person1.Name = "Greg"; db.Save(person1); var gregQuery = db.CreateIndexQuery<Person>("Name", "Greg"); foreach (var person in gregQuery) { Console.WriteLine(person.PersonId); } db.RemoveIndex<Person>("Name"); //This will fail because the index is removed. //gregQuery = db.CreateIndexQuery<Person>("Name", "Greg"); db.CloseDatabase();
Dim db As New NinjaDbPro("MyDatabaseDirectory", "MyDatabaseName") 'Licensed Mode 'db.UserName = "John Smith 101224"; 'db.LicenseKey = "aousdf832jasf=="; 'Set before OpenDatabase. Default storage is IsolatedStorageDatabase. Other options are: 'db.Storage = new MemoryDatabase(); //In memory database 'db.Storage = new FileDatabase(); db.OpenDatabase() db.AddIndex(Of Person)("Name", "Name", IndexStyle.NonUnique) Dim person1 As New Person() person1.Name = "Greg" db.Save(person1) Dim gregQuery = db.CreateIndexQuery(Of Person)("Name", "Greg") For Each person In gregQuery Console.WriteLine(person.PersonId) Next person db.RemoveIndex(Of Person)("Name") 'This will fail because the index is removed. 'gregQuery = db.CreateIndexQuery<Person>("Name", "Greg"); db.CloseDatabase()
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2