/// <summary> /// Makes the predicate. /// </summary> /// <param name="e1">The e1.</param> /// <param name="e2">The e2.</param> /// <param name="members">The members.</param> /// <param name="negate">if set to <c>true</c> [negate].</param> /// <returns></returns> protected Expression MakePredicate(Expression e1, Expression e2, IEnumerable <MemberInfo> members, bool negate) { var pred = members.Select(m => QueryBinder.BindMember(e1, m).Equal(QueryBinder.BindMember(e2, m))).Join(ExpressionType.And); if (negate) { pred = Expression.Not(pred); } return(pred); }