Public Sub CommitTransaction()
Dim instance As NinjaDbPro instance.CommitTransaction()
public void CommitTransaction()
public: void CommitTransaction();
Public Sub CommitTransaction()
Dim instance As NinjaDbPro instance.CommitTransaction()
public void CommitTransaction()
public: void CommitTransaction();
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(); Person person1 = new Person(); person1.Name = "John"; Person person2 = new Person(); person2.Name = "Jane"; db.OpenDatabase(); //These two persons will be saved as a group try { db.BeginTransaction(); db.Save(person1); db.Save(person2); db.CommitTransaction(); } catch (Exception) { //Rollback when there is an error db.RollbackTransaction(); throw; } //This will load a person since it was committed Person person1Copy = db.Load<Person>(person1.PersonId); 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(); Dim person1 As New Person() person1.Name = "John" Dim person2 As New Person() person2.Name = "Jane" db.OpenDatabase() 'These two persons will be saved as a group Try db.BeginTransaction() db.Save(person1) db.Save(person2) db.CommitTransaction() Catch e1 As Exception 'Rollback when there is an error db.RollbackTransaction() Throw End Try 'This will load a person since it was committed Dim person1Copy As Person = db.Load(Of Person)(person1.PersonId) 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