当我尝试以下操作时:
public List<MatterViewModel> ReturnMatchingMatters(IEnumerable<string> matterNames)
{
var filter = PredicateBuilder.True<tblMatter>();
filter = x => matterNames.Any(mattername => mattername.ToLowerInvariant() == x.Matter.ToLowerInvariant());
return this.dal.DB.GetList<MatterViewModel>(OrmLiteConfig.DialectProvider.ExpressionVisitor<tblMatter>().Where(filter).ToSelectStatement());
}
我收到错误:
variable 'x' of type '[...]tblMatter' referenced from scope '', but it is not defined
([...] 矿)
本质上,我想要完成的是,如果事项字符串包含在任何事项中,则谓词返回 true。
我错过了什么?我需要用临时变量做某种 foreach 吗?