entity framework transaction 用法
using (var scope = db.Database.BeginTransaction())
{
...
db.SaveChanges();
scope.Commit();
}
※ 跳出 exception 不須特別呼叫 Rollback()
※ 使用 TransactionScope 對同一個資料庫也會造成 msdtc 相關錯誤,不予採用
{
...
db.SaveChanges();
scope.Commit();
}
※ 跳出 exception 不須特別呼叫 Rollback()
※ 使用 TransactionScope 對同一個資料庫也會造成 msdtc 相關錯誤,不予採用
留言