title: How to map foreign keys to different Table/Column name in EF CodeFirst?
body: <p>How do I get the fields in User to map to LookUpDetail using EF Code First? (preferably using annotations, not FluentAPI)</p>
  
  <pre><code>public class User
  {
     public int? ProvStateId { get; set; }
     public LookUpDetail ProvState { get; set; }
     public int? CountryId { get; set; }
     public LookUpDetail Country { get; set; }
  }
  public class LookUpDetail
  {
     public int LookUpDetailId { get; set; }
     public string Value { get; set; }
  }
  </code></pre>
  
  <p>I want both ProvStateId and CountryId to map to LookUpDetailId, and be able to populate ProvState and COuntry when pulling a User record.</p>
  
  <p>I've tried</p>
  
  <pre><code>[ForeignKey("ProvStateId")]
  public LookUpDetail ProvState { get; set; }
  </code></pre>
  
  <p>And that seems to set the field in the DB, but
      LookUpDetail ProvState
  is always null when I try to pull a User record.</p>
  
  <p>The LookUpDetail table is populated and I am able to display it's contents just fine.</p>
  
  <p>What am I missing?</p>