0
我会尝试在伪代码中解释。关于事务的一个nhibernate会话问题
这里有两种会话 s1和s2
INT totalEntity = 0;
Thread1
{
s1.BeginTransaction();
loop (infinite)
{
totalEntity = s1.List<Entity>().Count();
}
s1.EndTransaction();
}
s2.BeginTransaction();
s2.Insert<Entity>();
s2.EndTransaction();
当我运行s2时,totalEntity仍然是零,因为s1.Transaction没有提交。我怎样才能得到真正的实体总数为1,在循环中?
您使用的是哪个数据库?哪个事务隔离级别? – 2011-06-15 06:49:12