title: Disable EF core query optimizer
body: <p>I have a query that contains this code as a part of the query:</p>
  
  <pre><code>from ShiftPeriod s in DbSet&lt;ShiftPeriod&gt;
  select s.DateFrom).Max() == [e].DateFrom
  </code></pre>
  
  <p>This is copied form EF log (Compiling query model). But after that there is Optimized query model in log which shows this:</p>
  
  <pre><code>from ShiftPeriod d in DbSet&lt;ShiftPeriod&gt;
  where !([d].Deleted)
  select s.DateFrom).Max() == [d].DateFrom
  </code></pre>
  
  <p>See how <code>s.DateFrom</code> is used instead of <code>d.DateFrom</code>. 
  And I get error saying: </p>
  
  <blockquote>
    <p>variable 's' of type 'EDD.Domain.Model.Shifts.ShiftPeriod' referenced from scope '', but it is not defined</p>
  </blockquote>
  
  <p>I want to know if I can somehow turn off this optimizer or if there is any other way of fixing this?</p>