title: One to one relationship with Entity Framework Fluent API
body: <p>I'm having trouble with reverse navigation on one of my entities. </p>
  
  <p>I have the following two objects:</p>
  
  <pre><code>public class Candidate
  {
      [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public long CandidateId { get; set; } 
      ....
  
      // Reverse navigation
      public virtual CandidateData Data { get; set; }
      ...
  
      // Foreign keys
      ....
  }
  
  public class CandidateData
  {
      [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public long CandidateDataId { get; set; }
  
      [Required]
      public long CandidateId { get; set; }
  
      // Foreign keys
      [ForeignKey("CandidateId")]
      public virtual Candidate Candidate { get; set; }
  }
  </code></pre>
  
  <p>Now my foreign key navigation on  the CandidateData object works fine. I am having trouble getting the reverse navigation for the candidate object to work (if that's even possible).</p>
  
  <p>This is my OnModelCreating function: </p>
  
  <pre><code>protected override void OnModelCreating(DbModelBuilder modelBuilder)
  {
      modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
  
      modelBuilder.Entity&lt;Candidate&gt;()
          .HasOptional(obj =&gt; obj.Data)
          .WithOptionalPrincipal();
  
      base.OnModelCreating(modelBuilder);
  }
  </code></pre>
  
  <p>It's close to working except in the database I get two columns that link to the CandidateId. I get the one I from the POCO object the I get another column  Candidate_CandidateId I assume was created by the modelBuilder. </p>
  
  <p>I am quiet lost at the moment. Can someone please shed some light on what's going on? </p>