Disclaimer: Strictly speaking, what I have here is not a many-to-many relationship, but given that he uses an associative table, I decided that it would be better to be a little less accurate in order to better understand what I'm doing.
I have the equivalent of the following three tables in my database:
Customer
---------
CustomerID PK
...
CustomerAddress
---------
CustomerID PK, FK -> Customer
AddressNo PK
... address columns ...
CustomerPrimaryAddress
--------------
CustomerID PK, FK -> Customer
AddressNo FK -> CustomerAddress (with CustomerID, so CustomerID
participates in both relationships)
If this is not obvious, you need to consider several addresses for each client, while indicating no more than one address per client as โprimaryโ. I use an associative table to avoid placing the null column PrimaryAddressNumberon Customer, and then create a foreign key from Customerto CustomerAddress.
, EF CustomerPrimaryAddress . - , . CustomerPrimaryAddress , Customer CustomerAddress :
Table Customer CustomerAddress
Multiplicity 1 0..1
CustomerPrimaryAddress , .
, EF , CustomerID CustomerPrimaryAddress , Customer, CustomerAddress.
? Customer , DBA, EF , .