title: SQL Difference EF 6 vs EF Core
body: <p>I'm migrating a Sofware from EF 6 to EF Core. During testing I noticed a difference on how the Linq is interpreted.</p>
  
  <p>My Linq</p>
  
  <pre><code>app.Deputies
     .Include(d =&gt; d.User)
     .Where(d =&gt; d.User == null)
     .ToList()
  </code></pre>
  
  <p>IN EF 6 it results in a query (simplified for reading purposes) like this</p>
  
  <pre><code>SELECT
    d.*
  FROM Deputy d
  LEFT JOIN User u ON u.Id = d.UserId
  WHERE u.Id IS NULL
  </code></pre>
  
  <p>IN EF Core the SQL Looks like this</p>
  
  <pre><code>SELECT
    d.*
  FROM Deputy d
  LEFT JOIN User u ON u.Id = d.UserId
  WHERE d.UserId IS NULL
  </code></pre>
  
  <p>Even if I do  <code>.Where(d =&gt; d.User.Id == null)</code> doesn't change the generated query.</p>
  
  <p>The Configuration for EF 6 looks like this:</p>
  
  <pre><code>.HasOptional(d =&gt; d.User).WithMany().HasForeignKey(d =&gt; d.UserId);
  </code></pre>
  
  <p>The Configuration for EF Core looks like this:</p>
  
  <pre><code>.HasOne(d =&gt; d.User).WithMany().HasForeignKey(d =&gt; d.UserId);
  </code></pre>
  
  <p>Did I miss something in the config or any Idea an how to achieve the same SQL like in EF 6?</p>
  
  <p>(I'm using SQL Server)</p>
  
  <p><strong>EDIT: There's no FK between Deputy and User on the DB. (Only in the model)</strong></p>