Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Entity framework Azure移动应用程序-实体框架-缺少外键和其他属性_Entity Framework_Azure_Foreign Keys_Azure Mobile Services - Fatal编程技术网

Entity framework Azure移动应用程序-实体框架-缺少外键和其他属性

Entity framework Azure移动应用程序-实体框架-缺少外键和其他属性,entity-framework,azure,foreign-keys,azure-mobile-services,Entity Framework,Azure,Foreign Keys,Azure Mobile Services,在Azure移动应用程序中,我试图向我的DataObject类添加外键属性 似乎任何属性都无法识别,我得到一个错误消息 using Microsoft.Azure.Mobile.Server; using System.ComponentModel.DataAnnotations.Schema; namespace SomeNameSpace.DataObjects { [ForeignKey("examplekeyname")] public string SomeDat

在Azure移动应用程序中,我试图向我的DataObject类添加外键属性

似乎任何属性都无法识别,我得到一个错误消息

using Microsoft.Azure.Mobile.Server;
using System.ComponentModel.DataAnnotations.Schema;

namespace SomeNameSpace.DataObjects
{
     [ForeignKey("examplekeyname")]
     public string SomeDataColmnName {get; set;}
我以前做过这件事,所以我不知道是什么原因造成的

再次阅读了几个Azure移动应用程序教程,但似乎不起作用

我收到以下错误消息:

错误CS0246
找不到类型或命名空间名称“ForeignKeyAttribute” (是否缺少using指令或程序集引用?)


这不仅仅是外键。。其他属性显示相同的行为。。。与
[必需]

类似,这些属性位于assembly System.ComponentModel.DataAnnotations中。请参阅MSDN。

再次感谢唐娜。似乎我必须1)添加System.ComponentModel.DataAnnotations作为对项目的引用,2)使用System.ComponentModel.DataAnnotations.Schema添加;