How do add NOLOCK with nHibernate?

后端 未结 7 1226
再見小時候
再見小時候 2020-11-29 03:43

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

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-29 04:06

    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.

提交回复
热议问题