我想创建一个超过3-4 Expression.Or的查询?但Expression.Or只是让我在其中添加两个表达式.
if (!string.IsNullOrEmpty(keyword)) query .Add(Expression.Or( Expression.Like("Name", keyword, MatchMode.Anywhere), Expression.Like("LastName", keyword, MatchMode.Anywhere))) .Add(Expression.Or( Expression.Like("Email1", keyword, MatchMode.Anywhere), Expression.Like("Email2", keyword, MatchMode.Anywhere)));
上面的代码生成"名称像%this this或LastName like%this%AND Email1 like%this%和Email2 like%this.
提前致谢.
使用Disjunction而不是Or.