Hi,
How do you add NOLOCK when using nhibernate? (criteria query)
Hi,
How do you add NOLOCK when using nhibernate? (criteria query)
For NHibernate 2.1, use the SetLockMode method off of CreateCriteria.
session.CreateCriteria(...).SetLockMode(LockMode.None).List();
If you are going to use it in a lot of your queries, you can set it as default via the configuration property connection.isolation
.
<property name="connection.isolation">ReadUncommitted</property>
Check out the documentation on this property.