I have a DateRange class that I\'d like to apply to an IQueryable as a where predicate, automatically using the begin and end dates and automatically using an open or closed int
You'll have to hand-craft dateField >= BeginDate
using Expression class methods.
(...)
if (BeginInclusive)
{
var greaterOrEqual =
Expression.Lambda>(
Expression.GreaterThanOrEqual(
dateField.Body,
Expression.Constant(BeginDate)),
dateField.Parameters);
result = result.Where(greaterOrEqual);
}
(...)
Similarly for the other cases.