title: EntityFramework GroupBy Entity Type
body: <p>I have a base entity A, and derived entities: AA, AB, AC, AD</p>
  
  <pre><code>context.A.GroupBy(x =&gt; x.GetType()).Select(x =&gt; new { type=x.GetType(), count = x.Count() });
  </code></pre>
  
  <p>Of course I get error:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.Type GetType()'
    method, and this method cannot be translated into a store expression.</p>
  </blockquote>
  
  <p>How can i group derived entities by type?</p>