I have a method that looks like this
public class Site
{
public virtual ICollection<SalesOrder> soDetails { get; private set; }
public int? IncomingOSI(Site s)
{
PIC_Program_1_0Context db = new PIC_Program_1_0Context();
List<SalesOrder> so = db.SalesOrders
.Where(x => x.siteID == s.ID)
.Where(x => x.DateCreated > DateTime.Now.AddDays(-30)).ToList();
}
}
But currently this returns an error of
'LINQ to Entities does not recognize the method 'System.DateTime AddDays(Double)' method, and this method cannot be translated into a store expression.'
What is the reason for this?