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.
Ayende goes into the correct answer on his blog:
If you're using
you can do the following:
SELECT {person.*}
FROM People {person} WITH(nolock)
WHERE {person}.Name LIKE :name
Note the WTIH(nolock)
appended to the FROM
clause.