实体框架CTP 5 RelatedTo属性不起作用 [英] Entity Framework CTP 5 RelatedTo Attribute not working
问题描述
使用Entity Framework CTP 5,我试图在我的课程中列出一个外键列表. 但是我不断收到一条错误消息,提示找不到相关的收件人."
Using Entity Framework CTP 5 I am trying to make a list of foreign keys in my class. But I keep getting an error which says RelatedTo can not be found.
这是代码:
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 BusinessLogic
Error 2 The type or namespace name 'RelatedTo' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\wep\Bureaublad\WEPProject\branches\codefirst Entity Framework\BusinessLogic\BusinessLogic\VertragsVerweisBLL.cs 37 10 BusinessLogic
由于某种原因,它确实从System.ComponentModel.DataAnnotations中识别键属性.为什么它不识别RelatedTo?
For some reason it DOES recognize the Key Attribute from System.ComponentModel.DataAnnotations. Why does it not recognize RelatedTo?
推荐答案
我建议您升级到EF4.1 ...也许可以解决您的问题.如果不是,请更新您的问题:)
I would recommend you upgrade to EF4.1 ... Perhaps your problem is solved with that. If not - update your question :)
这篇关于实体框架CTP 5 RelatedTo属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!