具有3个OR条件的DetachedCriteria

Rom*_*man 1 nhibernate fluent-nhibernate

如何使用DetachedCriteria实现此查询:

Select * from 
    MyTable
Where 
    (conditionA = true) or 
    (conditionB = true) or 
    (conditionC = true) or 
    (conditionD = true)
Run Code Online (Sandbox Code Playgroud)

asg*_*las 5

像这样:

DetachedCriteria.For<MyTable>()
        .Add(Restrictions.Eq("conditionA", true) ||
             Restrictions.Eq("conditionB", true) ||
             Restrictions.Eq("conditionC", true) ||
             Restrictions.Eq("conditionD", true));
Run Code Online (Sandbox Code Playgroud)