Dim instance As NinjaDbPro Dim value As Integer value = instance.Truncate(Of T)()
Type Parameters
- T
Return Value
The number of items deleted
Dim instance As NinjaDbPro Dim value As Integer value = instance.Truncate(Of T)()
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(); Person person1 = new Person(); person1.DateCreated = DateTime.Now.AddDays(-1); person1.Name = "Greg1"; db.Save(person1); Person person2 = new Person(); person2.DateCreated = DateTime.Now.AddDays(-2); person2.Name = "Greg2"; db.Save(person2); Person person3 = new Person(); person3.DateCreated = DateTime.Now.AddDays(-3); person3.Name = "Greg3"; db.Save(person3); //Delete all persons db.Truncate<Person>(); //Reclaim the space used by the persons table db.Pack(); 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() Dim person1 As New Person() person1.DateCreated = Date.Now.AddDays(-1) person1.Name = "Greg1" db.Save(person1) Dim person2 As New Person() person2.DateCreated = Date.Now.AddDays(-2) person2.Name = "Greg2" db.Save(person2) Dim person3 As New Person() person3.DateCreated = Date.Now.AddDays(-3) person3.Name = "Greg3" db.Save(person3) 'Delete all persons db.Truncate(Of Person)() 'Reclaim the space used by the persons table db.Pack() 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