In my application I am using Entity Framework.
My Table
-Article
-period
-startDate
I need records that match => DateTime.Now > startDate and (startDate + period) > DateTime.Now
I tried this code but its now working
Context.Article
.Where(p => p.StartDate < DateTime.Now)
.Where(p => p.StartDate.AddDays(p.Period) > DateTime.Now)
When I run my code the following exception occur
LINQ to Entities does not recognize the method 'System.DateTime AddDays(Double)' method, and this method cannot be translated into a store expression.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…