Use OR Clause in queryover in NHibernate

拥有回忆 提交于 2019-11-29 04:06:12
Radim Köhler

Here is description how we can build OR with NHiberante

The syntax (in C# as the tag says) is:

  • Restrictions.Or(restriction1, restriction1)
  • Restrictions.Disjunction().Add(restriction1).Add(restriction2).Add(...

In this case, it could be like this (again in C#, while question seems to use VB):

db.QueryOver<Users>()()
  .Where((x) => x.Role == "Guest")
  .And(Restrictions.Or(
       Restrictions.Where<Users>((x) => x.Block == 0)
     , Restrictions.Where<Users>((x) => x.APPID == appId)
  ))
  .List<Users>();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!