title: EF Required to Optional Relationship not using the right columns for FK
body: <p>I already read many questions, but still couldn't find a solution to my problem.</p>
  
  <p>I am trying to have something like this I drawed very quickly</p>
  
  <p><a href="https://i.stack.imgur.com/RONdr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RONdr.png" alt="enter image description here"></a></p>
  
  <p><strong>First Try:</strong></p>
  
  <pre><code>public class CarMap : EntityTypeConfiguration&lt;Car&gt;
      {
          public CarMap()
          {
              ToTable("Cars", Constants.Schema);
              Property(t =&gt; t.EngineId);
  
              HasRequired(x =&gt; x.SPropertyPolicyInsurance).WithMany().HasForeignKey(x =&gt; x.SPropertyPolicyInsuranceId);
          }
      }
  
  
  
  public class Car : MyBase
      {
          public int EngineId { get; set; }
          public virtual Engine Engine { get; set; }
      }
  
  
  public class EngineMap : EntityTypeConfiguration&lt;Engine&gt;
      {
          public EngineMap()
          {
              ToTable("Engines", Constants.Schema);
  
              Property(t =&gt; t.MyField1).HasColumnType("nvarchar").HasMaxLength(128).IsRequired();
              Property(t =&gt; t.MyField2).HasColumnType("nvarchar").HasMaxLength(128).IsRequired();
              Property(t =&gt; t.MyField3).HasColumnType("bit").IsRequired();            
          }
      }
  
  
  public class Engine : MyBase
      {
          public string MyField1 { get; set; }
          public string MyField2 { get; set; }
          public bool MyField3 { get; set; }
  
          public virtual Car Car { get; set; }
      }
  </code></pre>
  
  <p>Using this solution it creates a new column on my Engine table that I don't want...</p>
  
  <p><strong>Second Try:</strong></p>
  
  <p>Changing the CarMap to the following code:</p>
  
  <pre><code>public class CarMap : EntityTypeConfiguration&lt;Car&gt;
      {
          public CarMap()
          {
              ToTable("Cars", Constants.Schema);
              Property(t =&gt; t.EngineId);
  
              HasRequired(x =&gt; x.Engine).WithOptional(p =&gt; p.Car);
          }
      }
  </code></pre>
  
  <p>The problem is that it doesn't use the column EngineId to store my FK key values...</p>
  
  <p>Thank you very much for your help anyway...</p>