在system.data.entity命名空间
中使用infrastructure namespace时收到错误消息答案 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.Entity
和System.Data.Entity
的新DLL。