EF 5.0 Code First Two way navigation withought foreign key id in child
问题 I have following classes public class Employer { [Key] public Int64 EmployerID { get; set; } public String CompanyName { get; set; } public virtual List<Employee> Employees { get; set; } } public class Employee { [Key] public Int64 EmployeeID { get; set; } public String EmployeeName { get; set; } public virtual Employer EmployerInfo { get; set; } } In the Database context I have set the relation as modelBuilder.Entity<Employer>() .HasMany(p => p.Employees) .WithRequired() .Map(x => x.MapKey(