1.设置隔离级别

var transactionOptions = new System.Transactions.TransactionOptions();
transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
using (var transactionScope = new System.Transactions.TransactionScope(System.Transactions.TransactionScopeOption.Required, transactionOptions))
{
    using (var context = new MyEntityConnection())
    {

    }
    transactionScope.Complete();
}

 2.更新数据

db.Product.Attach(model);
db.Entry(model).State = System.Data.EntityState.Modified;
db.SaveChanges();

 

相关文章:

  • 2021-07-11
  • 2021-08-07
  • 2022-01-30
  • 2021-10-30
  • 2021-06-29
  • 2021-07-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-26
  • 2021-05-31
  • 2021-11-26
  • 2022-12-23
  • 2021-06-17
相关资源
相似解决方案