title: Linq is not converting to SQL properly on runtime
body: <p>I have a simple LINQ query here but I get an exception</p>
  <blockquote>
  <p>function can only be invoked from LINQ to entities</p>
  </blockquote>
  <p>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 (<a href="https://stackoverflow.com/questions/59623549/this-function-can-only-be-invoked-by-linq-to-entities-after-entity-framework-upd">This function can only be invoked by LINQ to Entities after Entity Framework update</a>).</p>
  <pre><code>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 &amp;&amp;
                      SqlFunctions.DateDiff(&quot;yy&quot;,begin, end) &lt; 2                                                        
                select e.AnimalType
  </code></pre>