private static void FixBugs() { var wrongBugs = from b in Database.Query<BugDN>() where b.Status == Status.Fixed && !b.End.HasValue select b.ToLazy(); foreach (var lazyBug in wrongBugs) { BugDN bug = lazyBug.Retrieve(); bug.Description += "- Fix it!"; bug.Save(); } }
private static void FixBugs() { using (Transaction tr = new Transaction()) { var wrongBugs = from b in Database.Query<BugDN>() where b.Status == Status.Fixed && !b.End.HasValue select b.ToLazy(); foreach (var lazyBug in wrongBugs) { BugDN bug = lazyBug.Retrieve(); bug.End = bug.Start.AddDays(7); bug.Save(); } tr.Commit(); } }
private static void FixTheWorld() { FixBugs(); FixCustomers(); FixDevelopers(); }
private static void FixTheWorld() { using (Transaction tr = new Transaction()) { FixBugs(); FixCustomers(); FixDevelopers(); tr.Commit(); } }
//Creates a nestable transaction public Transaction()//If forceNew == true, the new transaction is independent from the parent public Transaction(bool forceNew) //Allows to change the IsolationLevel of the transaction (only if ends up being the parent trnasaction) public Transaction(IsolationLevel isolationLevel) //The two above combined public Transaction(bool forceNew, IsolationLevel? isolationLevel)
Transaction.CurrentConnection
Transaction.CurrentTransaccion