I have a list which contains multiple time frames.
Each time frame is a timeframe
class instance.
public class TimeFrame
{
public DateTime From { get; set; }
public DateTime To { get; set; }
}
I want to filter some entity by DateTime CreationDateTime
field with WHERE clause using all timeframes in my list combined with OR.
Something like this
SELECT
*
FROM
Entities
WHERE
((T1-From <= CreationDateTime) AND (CreationDateTime <= T1-To))
OR ((T2-From <= CreationDateTime) AND (CreationDateTime <= T2-To))
OR ((TN-From <= CreationDateTime) AND (CreationDateTime <= TN-To))
How can i do it using entity framework version 6?