entity-framework - Azure 移动应用程序 - Entity Framework - 缺少外键和其他属性

标签 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 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/

相关文章:

c# - 如何从 Entity Framework 4 升级到 EF6?

c# - DbQuery.Include() 方法 : Is there a strong-typed variant?

linux - 在 Linux 上的脚本中使用 azcopy 时如何避免出现提示?

database - Elasticsearch : Parent child vs Nested Document

linq - 如何使用 Linq 连接对象和实体?

entity-framework - Code First Entity Framework 和 Windows Azure SQL

azure - Azure 上的 Hadoop,我可以使用不同的 Blob 存储容器进行 I/O 吗?

azure - 并发在 Azure 表存储中不起作用

sql - Oracle SQL : not able to add foreign key to table -> invalid identifier?

用于创建外键的 MySQL 风格