title: Entity Framework: One to one issue in TPC hierarchy
body: <p>I have a TPC hierarchy like this:</p>
  
  <pre><code>    public abstract class Base
  {
      public Guid BaseId { get; set; }
      public string BaseName { get; set; }
  }
  public class Sub1 : Base
  {
      public Sub2 Vender { get; set; }
  }
  public class Sub2 : Base
  {
      public Sub1 Customer { get; set; }
  }
  public class MyDbContext : DbContext
  {
      public MyDbContext()
          : base("name=db")
      { }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder)
      {
          base.OnModelCreating(modelBuilder);
          modelBuilder.Entity&lt;Sub1&gt;().HasRequired(x =&gt; x.Vender).WithOptional(x =&gt; x.Customer);
          modelBuilder.Entity&lt;Sub1&gt;().Map(x =&gt;
              {
                  x.ToTable("Sub1s");
                  x.MapInheritedProperties();
              }).HasKey(x =&gt; x.BaseId);
          modelBuilder.Entity&lt;Sub2&gt;().Map(x =&gt;
              {
                  x.ToTable("Sub2s");
                  x.MapInheritedProperties();
              }).HasKey(x =&gt; x.BaseId);
      }
  
      public DbSet&lt;Base&gt; People { get; set; }
      public DbSet&lt;Sub2&gt; Venders { get; set; }
      public DbSet&lt;Sub1&gt; Customers { get; set; }
  }
  </code></pre>
  
  <p>Then I run the code and EF create tables (Sub1s and Sub2s). 
  But EF create an aditional Foreign Key for table Sub1, it do not use the Key of Sub1 as the Foreign Key..It generates an additional FK named Vender_BaseId..</p>