private static void TransactionDemo() { using (ITransactionKeeper tran = Db.Northwind.CreateTransaction()) { Db.Northwind.Execute("UPDATE Products SET ProductName='The Name' WHERE ProductID=115"); Db.Northwind.Execute("UPDATE Products SET ProductName='The Name2' WHERE ProductID=118"); tran.Commit(); } }
// 事务传递 static void TransactionPost2(ITransactionKeeper tran) { Console.WriteLine(tran.Get <string>("select 'ITransactionKeeper'")); }