Entity Framework 5 是否支持唯一约束? [英] Does Entity Framework 5 support unique constraints?

查看:31
本文介绍了Entity Framework 5 是否支持唯一约束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道 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:

更新:此功能已推迟,不会包含在实体框架 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...

http:///data.uservoice.com/forums/72025-entity-framework-feature-suggestions/suggestions/1050579-unique-constraint-ie-candidate-key-support

...因为显然目前它甚至不在 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=Roadmap

这篇关于Entity Framework 5 是否支持唯一约束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆