Created
January 31, 2012 09:52
-
-
Save danielwertheim/1709682 to your computer and use it in GitHub Desktop.
SisoDb - New transaction and session behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Behavior today. Everything within the Session is treated as ONE atom transaction. | |
using(var session = db.BeginSession()) | |
{ | |
session.Insert(myFoo); | |
session.InsertMany(myBars); | |
session.Update(mySuperFoo); | |
} | |
//Thinking of.... each operation against session is treated as ONE atom operation. | |
using(var session = db.BeginSession()) | |
{ | |
session.Insert(myFoo); //Transactional | |
session.InsertMany(myBars); //Transactional | |
session.Update(mySuperFoo); //Transactional | |
} | |
//with the possibility of overruling and get larger scope, e.g | |
using(var transaction = new SisoTransaction()) | |
{ | |
using(var session = db.BeginSession()) | |
{ | |
session.Insert(myFoo); | |
session.InsertMany(myBars); | |
session.Update(mySuperFoo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment