title: Defining multiple Foreign Key for the Same table in Entity Framework Code First
body: <p>I have two entities in my MVC application and I populated the database with Entity Framework 6 Code First approach. There are two city id in the Student entity; one of them for BirthCity, the other for WorkingCity. When I define the foreign keys as above an extra column is created named City_ID in the Student table after migration. Id there a mistake or how to define these FKs? Thanks in advance.</p>
  
  <p><strong>Student:</strong></p>
  
  <pre><code>public class Student
  {
      public int ID { get; set; }
  
      public string Name { get; set; }
  
      public string Surname { get; set; }
  
      public int BirthCityID { get; set; }
  
      public int LivingCityID { get; set; }
  
  
      [ForeignKey("BirthCityID")]
      public virtual City BirthCity { get; set; }
  
      [ForeignKey("LivingCityID")]
      public virtual City LivingCity { get; set; }
  }
  </code></pre>
  
  <p><br/></p>
  
  <p><strong>City:</strong></p>
  
  <pre><code>public class City
  {
      public int ID { get; set; }
  
      public string CityName { get; set; }
  
  
      public virtual ICollection&lt;Student&gt; Students { get; set; }
  }
  </code></pre>