在Azure移动应用程序中,我尝试向我的DataObject类添加外键属性。
似乎任何属性都无法识别,并且我收到错误消息..
using Microsoft.Azure.Mobile.Server;
using System.ComponentModel.DataAnnotations.Schema;
namespace SomeNameSpace.DataObjects
{
[ForeignKey("examplekeyname")]
public string SomeDataColmnName {get; set;}
我以前做过这样的事情,所以我很困惑到底是什么原因造成的。
再次浏览了几个 Azure 移动应用程序教程,但似乎不起作用。
我收到以下错误消息:
Error CS0246
The type or namespace name 'ForeignKeyAttribute' could not be found (are you missing a using directive or an assembly reference?)
这不仅仅是外键..其他属性也显示相同的行为...例如[Required]
最佳答案
这些属性位于程序集 System.ComponentModel.DataAnnotations 中。请参阅ForeignKeyAttribute Class在 MSDN 上。
关于entity-framework - Azure 移动应用程序 - Entity Framework - 缺少外键和其他属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38790205/