I have a question:
Is there a way to add "or" statement in ISession.QueryOver ?
Consider I have these values:
val1 = 0;
val2=0;
and my query:
.Where(Restrictions.Eq(Projections.Property()=>obj1.val1),val1) //Or statement should comes to here
.Where(Restrictions.Eq(Projections.Property()=>obj1.val2),val2)
So I need to get the datas whose val1 equals to local val1 OR whose val2 equals to val2.
CodePudding user response:
Try this:
.Add(Restrictions.Or(
Restrictions.Eq(Projections.Property()=>obj1.val1),val1),
Restrictions.Eq(Projections.Property()=>obj1.val2),val2)
)
)