有一个在EF CTP没有关键属性5 [英] There is no Key attribute in EF CTP 5

查看:134
本文介绍了有一个在EF CTP没有关键属性5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据这里的博客文章<一个href="http://blogs.msdn.com/b/efdesign/archive/2010/03/30/data-annotations-in-the-entity-framework-and-$c$c-first.aspx"相对=nofollow>数据注释中的实体框架应该有一个名为键栏中,它允许您标记一个实体的主键的属性。不过,我不能在.NET 3.5中或.Net 4.0查找此。

According to the blog post here Data Annotations in the Entity Framework there should be an attribute for a column called "Key" which allows you to mark the primary key of an entity. However I cannot locate this in .Net 3.5 or .Net 4.0.

我有什么遗漏?我已经包括了参考EntityFramework.dll,我已经检查了所有的属性在 System.ComponentModel.DataAnnotations 但我不能找到它。

What have I missed? I've included the reference to EntityFramework.dll and I've checked all the attributes under System.ComponentModel.DataAnnotations but I cannot locate it.

我已经把我的项目到.NET 4.0全(不是客户端配置文件)。

I have set my project to .Net 4.0 full (not client profile).

任何想法?

推荐答案

的<一个href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.keyattribute.aspx">KeyAttribute .NET是唯一的4,它位于 System.ComponentModel.DataAnnotations 组装所以一定要确保你已经提到了。

The KeyAttribute is .NET 4 only and it is located in the System.ComponentModel.DataAnnotations assembly so make sure you have referenced it.

这篇关于有一个在EF CTP没有关键属性5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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