实体框架5是否支持唯一约束? [英] Does Entity Framework 5 support unique constraints?
问题描述
想知道Entity Framework 5是否支持对实体属性的唯一约束?如果是这样,我如何指定一个属性应该是唯一的?
Wondering if Entity Framework 5 supports unique constraints on entity properties? If so, how can I specify that a property should be unique?
推荐答案
不,不是。过去曾计划在EF 5.0中包括一个独特的约束功能:
No, it doesn't. There were plans in the past to include a unique constraint feature in EF 5.0:
http://blogs.msdn.com/b/efdesign/archive/2011/03/09/unique-constraints-in -the-entity-framework.aspx
但是您可以看到帖子顶部有一个更新:
But you can see that there is an update on top of the post:
更新:此功能已被推迟,不会包含在
Entity Framework 5中。
Update: this feature has been postponed and will not be included in Entity Framework 5.
您可以对功能进行投票,以提高使用该功能实现的优先级...
You can vote on the feature to raise possibly the priority it gets implemented with...
...因为它显然是甚至还没有针对EF 6.0的路线图:
...because apparently it isn't even on the roadmap for EF 6.0 at the moment:
http://entityframework.codeplex.com/wikipage?title=路线图
这篇关于实体框架5是否支持唯一约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!