Consider the following Entity Framework Core 6.0 model classes:
public class Person
{
public int Id { get; set; }
[Required]
public int? PrimaryAddressId { get; set; }
public Address? PrimaryAddress { get; set; }
public int? SecondaryAddressId { get; set; }
public Address? SecondaryAddress { get; set; }
}
public class Address
{
public int Id { get; set; }
public List<Person> People { get; set; } = new();
}
From a functionality perspective, I want to be able to load an Address with any and all People related to that Address, and each Person will have at least one primary Address.
Does Entity Framework support mapping multiple foreign key/reference navigation properties in one model class to a single collection navigation property in another? If so, how is that expressed?