Ninja Database Lite
Backup Method
Example 



KellermanSoftware.NinjaDatabaseLite Namespace > NinjaDb Class : Backup Method
Make a backup of all database files into a backup directory
Syntax
Public Sub Backup( _
   ByVal backupNumber As Integer _
) 
Dim instance As NinjaDb
Dim backupNumber As Integer
 
instance.Backup(backupNumber)
public void Backup( 
   int backupNumber
)
public:
void Backup( 
   int backupNumber
) 

Parameters

backupNumber
Example
NinjaDbConfig config = new NinjaDbConfig();
string databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyApplication");
config.Storage = new FileDatabase(databasePath);
NinjaDb ninja = new NinjaDb(config);
 
Person person = new Person();
person.Name = "John";
person.PersonId = 1;
 
//Save
ninja.Save("Person1", person);
 
//Backup
ninja.Backup(1);
 
//Delete
ninja.Delete("Person1");
 
//Restore
ninja.Restore(1);
 
//Load
Person personCopy = ninja.Load<Person>("Person1");
 
//Get Keys 
List<string> keys = ninja.GetKeys();
Dim config As New NinjaDbConfig()
Dim databasePath As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MyApplication")
config.Storage = New FileDatabase(databasePath)
Dim ninja As New NinjaDb(config)
 
Dim person As New Person()
person.Name = "John"
person.PersonId = 1
 
'Save
ninja.Save("Person1", person)
 
'Backup
ninja.Backup(1)
 
'Delete
ninja.Delete("Person1")
 
'Restore
ninja.Restore(1)
 
'Load
Dim personCopy As Person = ninja.Load(Of Person)("Person1")
 
'Get Keys 
Dim keys As List(Of String) = ninja.GetKeys()
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

NinjaDb Class
NinjaDb Members