有人可以幫我回答如何用ObjectQuery bilder重寫原始SQL過濾器WHERE(...)或(...)嗎?如何使用ObjectQuery與由OR子句分隔的Where過濾器
String queryRaw = "SELECT ls.LocaleName, ls.IsActive, ls.LocaleDescription " +
"FROM RoutesEntities.Locales AS ls ";
//" WHERE ls.LocaleName = 'en' OR ls.LocaleName = 'de' "
this._queryData = new ObjectQuery<DbDataRecord>(queryRaw, routesModel);
我會使用Where()方法,但它會生成由AND分隔的子句,儘管我想用OR來代替。 QueryBilder有可能嗎? 我的意思是如何用它來生成「或分開」過濾器:
Where("it.LocaleName IN (@localeName)", new ObjectParameter("localeName", String.Join(",", localeName)))
感謝,阿爾喬姆