Description
I've got DB-context that I need to do some date range filters against.
Unfortunately I'm not able to alter the context, and currently it contains distinct date columns named start_date
and end_date
.
I know that if I could alter the model I could declare a public NpgsqlRange<DateTime> Period
column in the entity I could apply a query predicate as where myEntity.Period.Overlaps(new NpgsqlRange<DateTime>(x, y))
.
The problem I'm having is that I'm not able to alter the model, and I'm getting internal server errors when trying to new up the left hand side of the predicate (rather than defining it in the model):
`where new NpgsqlRange<DateTime>(myEntity.StartDate, myEntity.EndDate).Overlaps(new NpgsqlRange<DateTime>(x, y))`.
Is there any way I can apply date range predicated (AND daterange(start_date, end_date, '[]') && daterange(@p3, @p4, '[]')
without altering the entity?