Below example of one-to-one relationship throws an exception
public class User
{
public int Id { get; set; }
public Address Address { get; set; }
}
public class Address
{
public int Id { get; set; }
public User User { get; set; }
}
Exception says:
Unable to determine the principal end of an association between the types 'ConsoleApplication1.Address' and 'ConsoleApplication1.User'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
it works if i remove User property from Address but i don't want.
How can i have such a relationship without an exception ?