An existing DB schema has unique, non-primary, keys, and some foreign keys that rely on them.
Is it possible to define unique keys, which are not primary keys, in Entity Framework v4? How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve tried defining the following tables:
And a foreign key mapping from OrderItems.FriendlyOrderNum (Mant) to Orders.FriendlyOrderNum (one).
If unique non-primary keys are possible the following SSDL should work:
It doesn’t. There’s also no possibility for adding more <key> elements in an <EntityType>.
My conclusion is that non-primary unique keys are not support in EF 4.