BUG about QueryOperator

Topics: Developer Forum
Apr 7, 2010 at 1:42 AM

change set -65141,vs 2008-fx 3.5. With NHibernateDataContext, if using QueryOperator.Or to disjunction several Criterion,it would keeps on using AND. The bug lies in the fact that you are creating a new disjunction every time(in a loop) in Execute() method. My fixed code: //QueryTranslator.cs public void Execute() { ... Juction junction; if (_query.Operator==QueryOperator.Or) junction=Restrictions.Disjunction(); else junction=Restriction.Conjunction(); foreach(Criterion myCriterion ...) { ... throw ArgumentException(); junction.Add(criterion); } _criteria.Add(junction); }