I am using FluentNHibernate, and I have a list of records, mapped to an SQL Server 2008 view. Dirty reads are OK with me, not locking the tables is a priority.
The SQL Q
I'm not sure why, but the TransactionScope code did not work for me.
I used this code. Starting a new session below makes sure that you don't have an existing transaction already. (There are other ways to do it of course)
using (var session = _session.SessionFactory.OpenSession())
using (var txn = session.BeginTransaction(IsolationLevel.ReadUncommitted))
{
// bunch of select statements.
}
In the NHibernate Profiler I could see this:
begin transaction with isolation level ReadUncommitted