I am trying to build up a predicate which will filter my data. I have a List<int>
and I need get all data where the ID matches the data in the list. Can I do this?
Currently I have it working like so:
Expression<Func<MonthlyDebitingReportItem, bool>> predicate = PredicateBuilder.True<MonthlyDebitingReportItem>();
foreach (int item in monthlyDebitingFilter.WrittenOffIDs) {
predicate = predicate.Expand().And(r => r.WrittenOffID == item);
}
I would like to have fluid LINQ which would basically create LINQ like so:
Where ListOfIDs.Contains(ID)