Ninja Database Pro
RemoveIndex<T> Method
Example 



KellermanSoftware.NinjaDatabasePro Namespace > NinjaDbPro Class : RemoveIndex<T> Method
The class type
The name of the index to remove
Remove an index for the property of a type
Syntax
Public Sub RemoveIndex(Of T)( _
   ByVal indexName As String _
) 
Dim instance As NinjaDbPro
Dim indexName As String
 
instance.RemoveIndex(Of T)(indexName)
public void RemoveIndex<T>( 
   string indexName
)
public:
void RemoveIndexgeneric<typename T>
( 
   String^ indexName
) 

Parameters

indexName
The name of the index to remove

Type Parameters

T
The class type
Example
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()
Requirements

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

See Also

Reference

NinjaDbPro Class
NinjaDbPro Members