I have 2 tables:
Site:
public class Site
{
public int Id { get; set; }
public virtual PersonDetail Person { get; set; }
}
PersonDetail:
public class PersonDetail
{
public int Id { get; set; }
public virtual Site PbnSite { get; set; }
}
A site doesn't necessarily have a person, nor does a person necessarily have a site. The relationship is thus optional on both ends. I get the error:
Unable to determine the principal end of an association between the types 'Site' and 'PersonDetail'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
When trying to update my database using this schema. I know a solution would be to set one of them as required but seeing as none of them really are required I'd naturally assume that there would be a way to create an optional relationship.