缺少实体框架Include(lambda)扩展 [英] Missing Entity Framework Include(lambda) extension

查看:62
本文介绍了缺少实体框架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)扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆