1
.net 4.5中不再支持[foreign key("blah")]
?當我在dataannotations模型中導入時,intellisense告訴我它不存在。反轉屬性也是如此。他們是否試圖讓我們使用流暢的API來代替這些類型的操作?有流暢的API與數據註釋的標準嗎?.net 4.5外鍵數據註釋c#
型號:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace DevCentral.Entities
{
public partial class Category
{
[Key]
public int Id { get; set; }
[MaxLength(75), MinLength(1)]
public string Name { get; set; }
[Required]
public int ClassificationId { get; set; }
[ForeignKey("ClassificationId"), InverseProperty("Categories")]
public virtual Classification Classification { get; set; }
}
}
我絕對有它包括了..我使用.NET 4.5和System.ComponentModel的4.0版本。 DataAnnotations。我有一些DataAnnotations,如Key,Max和Min Length,但是ForeignKey不存在,不在intellisense或任何東西中。它讓我迷失了方向。感謝澄清雖然。另外,關於約定的任何提示都與數據註釋相關,而不屬於數據註釋。 – mtleising 2013-03-25 13:43:33
好吧,只是一個FYI,事實證明[ForeignKey]註釋是在System.ComponentModel.DataAnnotations.Schema – mtleising 2013-03-26 12:55:32
這是正確的,文檔的網址已經暗示了,但我只refeered到程序集文件名,對不起。 – 2013-03-26 13:00:35