I have this code:
from pr in e.ProgramSetup.Include("Program").Include("Program.Client") where pr.DateBegin < DateTime.Now && pr.DateEnd > DateTime.Now.AddDays(pr.DateEndOffset) select pr).ToList();
It does not work, because AddDays() is not possible to use for generating sql.
So is there some another way? Now i select everything and filter it finaly by foreach, but it is not good way in my opinion.
Problem is that pr.DateEndOffset is also only in db, it is not constant...
using System.Data.Entity; ... DbFunctions.AddDays(dateFromDataStore, numDaysToAdd);