When I attempt the following:
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());
}
I receive the error:
variable 'x' of type '[...]tblMatter' referenced from scope '', but it is not defined
([...] mine)
Essentially, what I'm trying to accomplish is to have the predicate return true if the matter string is contained within any of the matters.
What am I missing? Do I need to do some sort of foreach with a temp variable?