I have solved the problem with foreign key columns order in the database while using independent association with the help of EF migrations.
Disable automatic migrations and create initial migration for your data model.
For model class:
public class Session
{
public int? Id { get; set; }
public Track Track { get; set; }
public Car Car { get; set; }
public int Event { get; set; }
public DateTime Date { get; set; }
public string Name { get; set; }
}
the migration code will be generated:
CreateTable("dbo.Sessions", c => new
{
Id = c.Int(nullable: false, identity: true),
Event = c.Int(nullable: false),
Date = c.DateTime(nullable: false),
Name = c.String(nullable: false, maxLength: 64),
Car = c.Int(nullable: false),
Track = c.Int(nullable: false),
}) ...
Now just reorder the foreign key columns (Car, Track) by moving them up. When you create new database and open the table, the column order will be like expected.