2
在Azure移动应用程序中我试图添加一个外键属性到我的DataObject类。Azure移动应用程序 - 实体框架 - 缺失外键和其他属性
好像任何属性不承认,我得到一个错误味精..
using Microsoft.Azure.Mobile.Server;
using System.ComponentModel.DataAnnotations.Schema;
namespace SomeNameSpace.DataObjects
{
[ForeignKey("examplekeyname")]
public string SomeDataColmnName {get; set;}
我已经这样做过,所以我很困惑,是什么原因造成这一点。
再次尝试了几个Azure移动应用程序教程,但似乎没有工作。
我收到以下错误信息:
错误CS0246
类型或命名空间名称ForeignKeyAttribute“找不到 (是否缺少using指令或程序集引用?)
这不只是外键..其他属性显示相同的行为...像[Required]
谢谢唐娜,再次。看起来像我不得不1)添加System.ComponentModel.DataAnnotations作为项目的引用,和2)添加使用System.ComponentModel.DataAnnotations.Schema; – user1141547