本文介绍了实体框架CTP 5 RelatedTo属性不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用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;
}
}
这给了我错误:
由于某种原因,它确实从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属性不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!