Reputation: 2316
Is it possible in Entity Framework 5 to define a property as "Unique" besides the Key?
My Model already has a property "ID" which has the 'Key' attribute. Now I want another prperty to be unique. How can I achieve this?
Upvotes: 2
Views: 5842
Reputation: 28737
You cannot do that through EntityFramework, the only possibility is modifying your database.
It's in the pipeline however for EF 6: http://blogs.msdn.com/b/efdesign/archive/2011/03/09/unique-constraints-in-the-entity-framework.aspx
Upvotes: 4