I have a simple LINQ query here but I get an exception
function can only be invoked from LINQ to entities
Not to sure what it could be, I know it has to do with the SqlFunctions I am using but can't make out why. I have seen a prior solution to a similar issue but it does not apply for this scenario I believe (This function can only be invoked by LINQ to Entities after Entity Framework update).
DateTime begin = new DateTime(2021, 1, 1);
DateTime end = new DateTime(2022, 1, 1);
var dataSet = from e in _db.animals
where e.age == 2 &&
SqlFunctions.DateDiff("yy",begin, end) < 2
select e.AnimalType