【发布时间】:2011-03-31 12:39:12
【问题描述】:
使用实体框架 CTP 5 我正在尝试在我的班级中制作外键列表。 但我不断收到一条错误消息,提示找不到 RelatedTo。
代码如下:
public class VertragsVerweis : GenericBLL
{
[Key]
public String Uid
{
get;
set;
}
public String VertagsVerweisNr
{
get;
set;
}
public String Bezeichnung
{
get;
set;
}
public Boolean Reparatur
{
get;
set;
}
[RelatedTo(RelatedProperty="Artikel")]
public List<Artikel> Artikelen
{
get;
set;
}
}
这给了我错误:
错误 2 找不到类型或命名空间名称“RelatedTo”(您是否缺少 using 指令或程序集引用?) C:\Documents and Settings\wep\Bureaublad\WEPProject\branches\codefirst Entity Framework\BusinessLogic \BusinessLogic\VertragsVerweisBLL.cs 37 10 商业逻辑
由于某种原因,它确实识别出 System.ComponentModel.DataAnnotations 中的关键属性。为什么不识别 RelatedTo?
【问题讨论】:
标签: c# entity-framework-4 data-annotations code-first entity-framework-ctp5