devlife
devlife

Reputation: 16155

Entity Framework foreign keys to non-primary key fields

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).

Upvotes: 13

Views: 5223

Answers (1)

Ladislav Mrnka
Ladislav Mrnka

Reputation: 364409

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.

Upvotes: 9

Related Questions