找不到实体框架 4 注释 [英] Cannot find Entity Framework 4 annotations
问题描述
我正在尝试使用注释将 POCO 类映射到我的数据库表.我需要使用 Table
批注来指定我的表的名称,但我无法解析 Table
批注.
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.
注意:我导入了 System.Data.Entity
命名空间,但它不起作用.
Note: I imported System.Data.Entity
namespace but It doesn't work.
我必须导入哪个命名空间才能使用 EF 注释?
Which namespace do I have to import to use EF annotations?
注意 1我的意思是:
[Table("my_table")]
public class MyClass
{
// ...
}
注意 2 我的实体框架 dll 是 v4.0.30319
NOTE 2 My Entity Framework dll is v4.0.30319
推荐答案
我需要使用
Table
注解
您需要导入 System.Data.Linq 库,TableAttribute 可以从System.Data.Linq.Mapping
命名空间.
You need to import the System.Data.Linq library, the TableAttribute can be referenced from the System.Data.Linq.Mapping
namespace.
这篇关于找不到实体框架 4 注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!