EF中的“IsolationLevel.ReadUncommitted”是否从CACHE中读取?从缓存读取未提交的读取?
我有IsolationLevel.ReadUncommitted
Class Orders{
public int Id {get();set();}
public int OrderType {get();set();}
}
While(true){
var transactionOptions = new TransactionOptions
{
IsolationLevel = IsolationLevel.ReadUncommitted
};
using(TransactionScope(TransactionScopeOption.Required, transactionOptions))
{
var temp = context.Orders.Include(e => e.Customer).SingleOrDefault(e => e.Id == 1);
}
}
假设一个事务范围,首先,我有一个为了与命令类型“1”,临时被初始化到一行。如果我使用SSMS中的更新查询(MSSQL)将我的订单的orderType更新为“2”,则从上下文拉取的对象的订单类型仍然是“1”,尽管在DB中它的“2”。这是因为Read UnCommitted?
你提交'type = 2'更新了吗?未提交会让你阅读一个未提交的'2',读一个'1'指向其他问题。使用更高的TransIsolation应显示相同的结果。 – 2014-09-05 08:14:40