title: Entity Framework Core count does not have optimal performance
body: <p>I need to get the amount of records with a certain filter.</p>
  
  <p>Theoretically this instruction:</p>
  
  <pre><code>_dbContext.People.Count (w =&gt; w.Type == 1);
  </code></pre>
  
  <p>It should generate SQL like:</p>
  
  <pre><code>Select count (*)
  from People
  Where Type = 1
  </code></pre>
  
  <p>However, the generated SQL is:</p>
  
  <pre><code>Select Id, Name, Type, DateCreated, DateLastUpdate, Address
  from People
  Where Type = 1
  </code></pre>
  
  <p>The query being generated takes much longer to run in a database with many records.</p>
  
  <p>I need to generate the first query.</p>
  
  <p>If I just do this:</p>
  
  <pre><code>_dbContext.People.Count ();
  </code></pre>
  
  <p>Entity Framework generates the following query:</p>
  
  <pre><code>Select count (*)
  from People
  </code></pre>
  
  <p>.. which runs very fast.</p>
  
  <p>How to generate this second query passing search criteria to the count?</p>