title: LINQ to Entities does not recognize the method 'Int64 Max(Int64, Int64)' method, and this method cannot be translated into a store expression
body: <p>I'm getting this error message during runtime</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'Int64 Max(Int64, Int64)' method, and this method cannot be translated into a store expression.</p>
  </blockquote>
  
  <p>when I try to do this:</p>
  
  <pre><code>return _dbContext.Appointment.Where(x =&gt; Math.Max(x.Appointment.StartTime.Ticks, startTime.Ticks) &lt;= Math.Min(x.Appointment.EndTime.Ticks, endTime.Ticks));
  </code></pre>
  
  <p>The idea behind this query is that "if the latest start time is before the earliest end time, then you have some overlap/touching" in date and time.</p>
  
  <p>Is there any way to get this line working? I already checked if <code>EntityFunctions</code> has 'something', which wasn't the case.</p>