I'm trying to run the following:
backupEvents = backupEvents.Where(e => e.Timestamp >= DateTime.Now - new TimeSpan(0, 1, 0, 0));
But this gives me an error saying
"DbArithmeticExpression arguments must have a numeric common type".
Searching StackOverflow, I find that Arithmetic with DateTime is not supported in Entity Framework.
So I tried:
backupEvents = backupEvents.Where(o => DbFunctions.DiffHours(o.Timestamp, DateTime.Now) <= 1);
But I also can't use the DbFunctions offered as a solution, because I'm using SQLite, and it doesn't have them, and I get an error saying: "no such function: DiffHours"
So - is there a way to compare dates in SQLite, using entity?