criteriaCount.CreateCriteria(AdvertisementsProperties.City.ToString())
.Add(Expression.Like(CitiesProperties.Name.ToString(), query, MatchMode.Anywhere))
.Add(Expression.Like(CitiesProperties.SlovenianName.ToString(), query, MatchMode.Anywhere))
.CreateCriteria(AdvertisementsProperties.Country.ToString())
.Add(Expression.Like(CountriesProperties.Name.ToString(), query, MatchMode.Anywhere))
.Add(Expression.Like(CountriesProperties.SlovenianName.ToString(), query, MatchMode.Anywhere));
这将返回 "name like %foo% and slovenianName like %foo% and name like %foo% and slovenianName like %foo%"
但我想得到“像%foo%或像%foo%这样的slovenianName或像%foo%或像%foo%这样的slovenianName这样的名字”
我可以将 Expression.Disjunction() 用于 OR,但我有一个问题,即我不能在 Expression.Disjunction() 中使用 CreateCriteria。有人可以告诉我如何一起使用 OR 和 CreateCriteria 吗?
问候