Entity Framework CTP 5 RelatedTo Attribute not working
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.
Here is the code:
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<Artike开发者_运维技巧l> Artikelen
{
get;
set;
}
}
This gives me the error:
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
For some reason it DOES recognize the Key Attribute from System.ComponentModel.DataAnnotations. Why does it not recognize RelatedTo?
AFAIK the "RelatedTo"-Attribute did not make it into the RC. List of supported annotions is here under section 8: ADO Team blog
EDIT: I found the blog entry I was looking for originaly: EF design blog. "RelatedTo" is listed under "New Data Annotation Attributes", where they say that they propose these attributes.
I would recommend you upgrade to EF4.1 ... Perhaps your problem is solved with that. If not - update your question :)
精彩评论