title: How can I cast to subclass when using LINQ and TPT EF?
body: <p>I have the following class hierarchy:</p>
  
  <pre><code>public class RealPeople { }
  
  public class Users : RealPeople { }
  public class People : RealPeople { }
  </code></pre>
  
  <p>In my dbContext, I defined a dbSet for <code>RealPeople</code> and on the OnModelCreating procedure, I specified separated tables for People and Users: </p>
  
  <pre><code>modelBuilder.Entity&lt;Users&gt;().ToTable("Users");
  modelBuilder.Entity&lt;People&gt;().ToTable("People");
  </code></pre>
  
  <p>This creates the corresponding full hierarchy in my DB, with the 3 corresponding tables.
  The problem comes when I want to retrieve the list of <code>Users</code> in my DB. 
  This:</p>
  
  <pre><code>List = (from Reg in PersistentMgr.RealPeople select (Users)Reg)
         .ToList();
  </code></pre>
  
  <p>or this:</p>
  
  <pre><code>List = (from Reg in PersistentMgr.RealPeople select (Users)((RealPeople)Reg))
         .ToList();
  </code></pre>
  
  <p>Throws an exception: </p>
  
  <blockquote>
    <p>LINQ only being able to cast primitive model types.</p>
  </blockquote>
  
  <p>So the thing is, I can't cast RealPeople to the corresponding subclass Users.
  Any ideas on this one?</p>