本文介绍了如何使用nHibernate添加NOLOCK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在使用nhibernate时添加NOLOCK? (标准查询)解决方案
或不附加 NOLOCK
给你的查询。
Ayende进入 c $ c>< 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>
请注意 WTIH(nolock)
FROM
子句。
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 <sql-query>
you can do the following:
<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.
这篇关于如何使用nHibernate添加NOLOCK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!