I'm trying to create a linq query to get all date 1 year back (expecting 365 values)
using (var context = new Context1())
{
var query = (from c in context.Daily25Data
where c.Date > DateTime.Now.AddYears(-1)
select c).ToList();
Console.WriteLine(query);
}
tried to use the above code but get exception
Additional information: LINQ to Entities does not recognize the method 'System.DateTime AddYears(Int32)' method, and this method cannot be translated into a store expression.