title: Code First - Entity Framework - How to expose foreign keys
body: <p>I have the following data object:</p>
  
  <pre><code>public class Customer : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration&lt;Customer&gt;
  {
      public Customer ()
      {
          // this.HasRequired(a =&gt; a.EyeColorType).WithMany().HasForeignKey(a =&gt; a.EyeColorTypeID);
      }
  
      [Key]
      public int ID { get; set; }
  
      [Required]
      [MaxLength(100)]
      public string FirstName { get; set; }
  
      [Required]
      [MaxLength(100)]
      public string LastName { get; set; }
  
      [Required]
      [ForeignKey("EyeColorTypeID")]
      public EyeColorType EyeColorType { get; set; }
      // public int EyeColorTypeID { get; set; }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>What I am trying to do, is expose the field <code>EyeColorTypeID</code> on the generated Customer property, as well as specify the name in the DB.</p>
  
  <p>If I remove both comments, it works, but I would like to use a data annotation for this. Something like <code>[ExposeForeignKey("EyeColorTypeID")]</code> and have it all happen automatically.</p>
  
  <p>Is this possible? How would I go about that?</p>