标签:
命名空间System.Transactions;
using (TransactionScope scope = new TransactionScope())
{
//Do something with context1
//Do something with context2
//Save Changes but don‘t discard yet
context1.SaveChanges(false);
//Save Changes but don‘t discard yet
context2.SaveChanges(false);
//if we get here things are looking good.
scope.Complete();
context1.AcceptAllChanges();
context2.AcceptAllChanges();
}
摘自:http://blog.csdn.net/yanwushu/article/details/10307801
标签:
原文地址:http://www.cnblogs.com/jt789/p/4626337.html