Using EF5 Code first, I have two classes:
[Table(\"UserProfile\")]
public class UserProfile {
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)
You define the principal when you map:
modelBuilder.Entity()
.HasOptional(f => f.Baz). //Baz is dependent and gets a FK BarId
.WithRequired(s => s.Bar);//Bar is principal
modelBuilder.Entity()
.HasOptional(f => f.Bar). //Bar is dependent and gets a FK BazId
.WithRequired(s => s.Baz);//Baz is principal
The dependent gets the foreign key that references the principal's key. When it's a one to one, that foreign key is also the dependent's primary key but EF can't work out which is which and that's why you get an error until you've specified it.
References:
http://msdn.microsoft.com/en-us/library/ee382827.aspx
https://stackoverflow.com/a/19580798/150342