title: When using entity framework code-first mapping property to separate table, moves foreign key field
body: <p>Having odd problem with mapping tables with code-first EF. I have a parent class "Contract" with a many-1 relationship from another class "Supplier". The requirement came up to store a scanned copy of the contract within the Contract entity. To keep from having to query the document bytes every time, I want to store this property in a separate table. I can make EF store the ContractDocument in a separate table, but for some reason the FK to suppliers ends up in the ContractDocument table instead of the parent table.</p>
  
  <pre><code>public class Contract
  {
      public Guid Id {get;set;}
      ...
      public virtual ContractDocument Document {get;set;}
      public virtual Supplier Supplier {get;set;}
  }
  
  public class ContractDocument
  {
      public string MimeType {get;set;}
      public byte[] Data {get;set;}
  }
  </code></pre>
  
  <p>In DbContext:</p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      modelBuilder.Entity&lt;Contract&gt;()
                  .Map(m =&gt; m.Properties(p =&gt; p.Document))
                  .ToTable("ContractDocument");
      base.OnModelCreating(modelBuilder);
  }
  </code></pre>
  
  <p>The table "ContractDocument" is created with correct properties, and does save data. However, it also contains the FK field "Supplier_Id". The "Contract" table no longer contains any FK fields.</p>