I have two models:
public class Person { public virtual int Id { get; set; } public virtual Employee Employee { get; set; } // optional } public cla
There's actually a better way to do this:
HasKey(e => e.PersonId); HasRequired(e => e.Person) .WithOptional(p => p.Employee);
Note that you no longer need the Employee.Id property with this approach, as it was superfluous in terms of a 1 to 0 or 1 relationship in the first place.
Employee.Id