How do you add NOLOCK when using nhibernate? (criteria query)
SetLockMode(LockMode.None) or connection.isolation ReadUncomitted does NOT append a NOLOCK to your queries.
SetLockMode(LockMode.None)
connection.isolation ReadUncomitted
NOLOCK
Ayende goes into the correct answer on his blog:
If you're using <sql-query> you can do the following:
<sql-query>
<sql-query name="PeopleByName"> <return alias="person" class="Person"/> SELECT {person.*} FROM People {person} WITH(nolock) WHERE {person}.Name LIKE :name </sql-query>
Note the WTIH(nolock) appended to the FROM clause.
WTIH(nolock)
FROM
2.1m questions
2.1m answers
60 comments
57.0k users