12
votes

Is it possible for Entity Framework 4.0 to have an association/navigation property based off of a foreign key to a non-primary key field (it has a unique constraint).

1
Voted to close as a duplicate though I believe that this question very nicely and concisely expresses the intent of the desired capability. Please note that an answer I provided at the referenced question indicates that Microsoft implemented this capability in EF Core 1.0 (EF7), but has no plans to implement it in EF6. - DavidRR

1 Answers

8
votes

No because EF don't understand unique constraint yet and relations in EF must follow same rules as relations in database. Without unique principal relation cannot exist and the only way to get unique principal in EF is using primary key.