title: How can i make Entity Framework TPT inheritance to build one table per each type
body: <p>I'm trying to make an inheritance TPT Entity Framework to build tables for each type.i searched the site and saw all but the code i based by them will only build one table for all
  here is my classes</p>
  
  <pre><code>    public class Foo
  {
      [Key]
      public int Id { get; set; }
      public int MainFooProp { get; set; }
  }
  
  public class FooA : Foo
  {
      public int FooAProp { get; set; }
  }
  
  public class FooB : Foo
  {
      public int FoobProp { get; set; }
  }
  </code></pre>
  
  <p>and my Context is</p>
  
  <pre><code> public DbSet&lt;FooA&gt; FooAs { get; set; }
   public DbSet&lt;FooB&gt; FooBs { get; set; }
  </code></pre>
  
  <p>and in modelBuilder i used</p>
  
  <pre><code>modelBuilder.Entity&lt;Foo&gt;().ToTable("Foos")
          .Map&lt;FooA&gt;(fa =&gt; fa.Requires("FooType").HasValue(1))
          .Map&lt;FooB&gt;(fb =&gt; fb.Requires("FooType").HasValue(2));
  </code></pre>
  
  <p>i want it to build one table for each including Foo
  <strong>it should make something like this diagram</strong>
  <a href="https://i.stack.imgur.com/lBjAp.png" rel="nofollow">diagram of what i really want</a></p>
  
  <p>but unfortunately it only makes one table including all properties.
  sorry guys but i really desperate to make it work</p>