.net core里 EF的事务-代码示例
using (var context = new BloggingContext())
{
using (var transaction = context.Database.BeginTransaction())
{
context.Blogs.Add(new Blog {Url = "http://www.cnbing.net"});
context.SaveChanges();
context.Blogs.Add(new Blog {Url = "http://cnbing.net/"});
context.SaveChanges();
transaction.Commit();
}
}