如何使用 nHibernate 添加 NOLOCK? [英] How do add NOLOCK with nHibernate?

查看:18
本文介绍了如何使用 nHibernate 添加 NOLOCK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用nhibernate时如何添加NOLOCK?(条件查询)

How do you add NOLOCK when using nhibernate? (criteria query)

推荐答案

SetLockMode(LockMode.None)connection.isolation ReadUncomitted 不会将 NOLOCK 附加到您的查询中.

Ayende 进入 他博客上的正确答案:

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>

注意 WTIH(nolock) 附加到 FROM 子句.

Note the WTIH(nolock) appended to the FROM clause.

这篇关于如何使用 nHibernate 添加 NOLOCK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆