En mi aplicación utilizo Entity Framework.Linq to EntityFramework DateTime
Mi Tabla
-Article
-period
-startDate
que necesitan los registros que coinciden =>DateTime.Now > startDate and (startDate + period) > DateTime.Now
probé este código, pero su ahora trabaja
Context.Article
.Where(p => p.StartDate < DateTime.Now)
.Where(p => p.StartDate.AddDays(p.Period) > DateTime.Now)
Cuando ejecuto mi código de la siguiente excepción se produce
LINQ to Entities does not recognize the method 'System.DateTime AddDays(Double)' method, and this method cannot be translated into a store expression.
¿Qué tipo es 'period'? 'AddDays' es la función incorrecta si es un' doble'. –
tipos de períodos es int – Yucel