命名空间名称Infrastructure在命名空间system.data.entity中不存在

时间:2012-11-27 03:54:35

标签: .net

在system.data.entity命名空间

中使用infrastructure namespace时收到错误消息

3 个答案:

答案 0 :(得分:16)

您还需要对EntityFramework的引用,否则您将收到相同的错误。

答案 1 :(得分:4)

您需要添加对.NET程序集System.Data.Entity.dll的引用。

答案 2 :(得分:2)

我有类似的问题。我提到了class Category has_many :children, :class_name => "Category", :foreign_key => "parent_id" has_many :published_pages, :class_name => "Page", :conditions => { :is_published => true } end ,但它抱怨System.Data.Entity。解决方案是添加EntityFramework nuget。安装后,它实际上删除了原始的System.Data.Entity.Infrastructure引用,并指向包含System.Data.EntitySystem.Data.Entity的新DLL。