0

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<Artikel> 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?

Stupidity
  • 79
  • 1
  • 11

2 Answers2

2

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.

Stephan Keller
  • 1,623
  • 11
  • 13
1

I would recommend you upgrade to EF4.1 ... Perhaps your problem is solved with that. If not - update your question :)

Yngve B-Nilsen
  • 9,606
  • 2
  • 36
  • 50