缺少实体框架Include(lambda)扩展

编程入门 行业动态 更新时间:2024-10-25 11:26:14
本文介绍了缺少实体框架Include(lambda)扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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)扩展

本文发布于:2023-11-15 12:31:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1594462.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:实体   框架   lambda   Include

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!