EF OjbectSet.Include(a =&>; a.parent)扩展名不可用。我知道我可以添加代码来模仿它,但是根据 EntityFramework 4已升级为5,lambda不可用。我在中使用System.Data.Entity ,并在主项目中将其升级到EF 5。
The EF OjbectSet.Include(a => a.parent) extension is unavailable. I know I could add code to mimic it, but according to EntityFramework 4 upgraded to 5, lambda is not available it should be available. I have the using System.Data.Entity, and am upgraded to EF 5 in my main project.
程序集System.Data.Entity.dll,v4.0.0.0中的元数据(C:\Program Files(x86)\参考程序集\Microsoft\Framework.NETFramework\v4.5\System.Data。 Entity.dll)
Looking the metadata in Assembly System.Data.Entity.dll, v4.0.0.0 (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\System.Data.Entity.dll)
... public ObjectQuery<System.Data.Common.DbDataRecord> GroupBy(string keys, string projection, params ObjectParameter[] parameters); public ObjectQuery<T> Include(string path); public ObjectQuery<T> Intersect(ObjectQuery<T> query);此处没有包括lambda变体的声明。我已经检查过了,根据数据库第一代实体框架5 System.Data.Entity与EntityFramework 。该项目正在生成4.5程序集。
There is no declaration for the lambda variant of Include here. I've checked and the file version is 4.0.30319.17929, as per Database first generation Entity Framework 5 System.Data.Entity vs EntityFramework . The project is generating a 4.5 assembly.
如果有意义,则在该程序集中不会引用EntityFramework本身。它只有一些数据服务,因此它确实包含对System.Data.Entity和主数据层项目的引用。
In case it's relevant, EntityFramework itself is not referenced in this assembly. It just has some data services, so it does include references to System.Data.Entity and the main data layer project.
有什么想法吗?
推荐答案根据 MSDN ,该方法在 EntityFramework 程序集中定义。 (在EntityFramework.dll中)
According to MSDN, the method is defined in the EntityFramework assembly. (in EntityFramework.dll)
您还需要添加对 EntityFramework.dll DLL的引用。
You'll need to add a reference to the EntityFramework.dll DLL as well.
然后,您需要确保引用了命名空间:
Afterwards, you'll need to make sure you're referencing the namespace:
使用System。 Data.Entity;
更多推荐
缺少实体框架Include(lambda)扩展
发布评论