Не удается установить IsolationLevel.ReadUncommitted с помощью Session.BeginTransaction
Я пытаюсь установить IsolationLevel.ReadUncommitted, используя следующий код
public class EntityRepository : RepositoryBase<Entity>, IEntityRepository
{
...
public void SomeFunction()
{
using (var transaction = Session.BeginTransaction(IsolationLevel.ReadUncommitted))
{
// Profiler log: set transaction isolation level read committed
try
{
Session.Query<Entity>().Count();
// Profiler log: select count(*) from dbo.Entity
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
}
...
}
Но мой Профилировщик говорит, что запрос был выполнен с подтвержденным уровнем чтения.
Если SomeFunction заменить на
public void SomeFunction()
{
// 1. set isolation level uncommeted
using (var transaction = Session.BeginTransaction(IsolationLevel.ReadUncommitted))
{
// Profiler log: set transaction isolation level read committed
try
{
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
// 2. execute query
Session.Query<Entity>().Count();
// Profiler log: set transaction isolation level read uncommitted
// Profiler log: select count(*) from dbo.Entity
// 3. set isolation level committed
using (var transaction = Session.BeginTransaction(IsolationLevel.ReadCommitted))
{
// Profiler log: set transaction isolation level read uncommitted
try
{
transaction.Commit();
}
catch
{
transaction.Rollback();
throw;
}
}
}
Вызов запросов с IsolationLevel.ReadUncommitted. Шаг 1. Установите уровень изоляции readuncommitted для сеанса. Шаг 2. Назовите мой запрос с уровнем изоляции readuncommitted. Шаг 3. Установите уровень изоляции сеанса для повторной отправки обратно.
Почему это происходит? Как это исправить?
FluentNHibernate 1.3.0.733