Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find Entity Framework 4 annotations

I'm trying to map a POCO class to a table of my DB using annotation. I need to use Table annotation to specify the name of my table, but I cannot resolve the Table annotation.

Note: I imported System.Data.Entity namespace but It doesn't work.

Which namespace do I have to import to use EF annotations?

NOTE 1 I mean:

[Table("my_table")]
public class MyClass
{
    // ...
}

NOTE 2 My Entity Framework dll is v4.0.30319

like image 406
davioooh Avatar asked Dec 08 '22 19:12

davioooh


1 Answers

You should import the System.ComponentModel.DataAnnotations namespace.

edit for .net 4.5 and EF 5.0: you should use System.ComponentModel.DataAnnotations.Schema.Table Attribute

like image 152
Manu Clementz Avatar answered Dec 11 '22 09:12

Manu Clementz