tengo el siguiente códigoLINQ a Entidades no SqlFunctions.DateDiff apoyado
DateTime now = DateTime.UtcNow;
var allItemsOver64 = _inventoryContext.Items.Where(i =>
(SqlFunctions.DateDiff("dd", i.PrimaryInsured.DoB, now)/365.0) >= 65);
IQueryable<Item> items65To69 = allItemsOver64.Where(i =>
(SqlFunctions.DateDiff("dd", i.PrimaryInsured.DoB, now)/365.0) >= 65 &&
(SqlFunctions.DateDiff("dd", i.PrimaryInsured.DoB, now)/365.0) <= 69);
Pero cuando intento y utilizo tanto allItemsOver64 Items65To69.Count() me sale este error
La expresión ((((Convertir (DateDiff ("dd", [10007] .PrimaryInsured.DoB, 26/04/2012 15:03:09))/365)> = 65) Y ((Convert (DateDiff ("dd") , [10007] .PrimaryInsured.DoB, 26/04/2012 15:03:09))/365)> = 65)) Y ((Convert (DateDiff ("dd", [10007] .PrimaryInsured.DoB, 26/04/2012 15:03:09))/365) < = 69)) no es compatible.
¿Qué estoy haciendo mal?
Gracias por la edición Arion. –
¿Qué sistema RDBMS estás usando? –