Entity Framework 5 是否支持唯一约束?

编程入门 行业动态 更新时间:2024-10-28 02:35:03
本文介绍了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:

blogs.msdn/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...

/data.uservoice/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:

entityframework.codeplex/wikipage?title=Roadmap

更多推荐

Entity Framework 5 是否支持唯一约束?

本文发布于:2023-07-11 17:12:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1094798.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Entity   Framework

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!