EF 6中缺少QueryableExtensions

ZwoRmi

我无法调用EntityFramework 6随附的新QueryableExtensionsToListAsyncForEachAsync...)。但是我可以调用其他(IncludeIntersect)。

我有个参考System.Data.Entity因此,显然,我有的较旧System.Data.Entity版本和EntityFramework的最新版本。可能吗?

我的代码无法编译,并且无法ForEachAsync在对象浏览器中看到该方法。

我正在使用Visual Studio 2013,.Net 4.5,EntityFramework 6.1.3,Wpf。

编辑

实体框架已安装: EF已安装

我尝试过多次卸载然后重新安装软件包,并重新启动了Visual Studio。还是行不通

编辑

在另一个项目(此项目引用)中,我可以IQueryableExtensions在对象浏览器中看到所需的项目。如果我将此项目添加到解决方案中(之前只是参考),IQueryableExtensions则对象浏览器中缺少所需的项目。

彼得·阿夫拉姆

您的一个项目可能针对的是.net框架的较旧版本。

当一个项目面向.Net v4.0时,我遇到了这个问题,将其更新为4.5或更高版本。此后,我还运行了其他人推荐的命令。

update-package -reinstall EntityFramework 

在程序包控制台中运行update-package命令时,可以看到目标是.Net的版本。例如,我的项目定位到4.0时的输出

PM> Update-Package –reinstall EntityFramework
Attempting to gather dependencies information for multiple packages with respect to project '[My project]', targeting '.NETFramework,Version=v4.0'

然后使用v4.5.2:

PM> Update-Package –reinstall EntityFramework
Attempting to gather dependencies information for multiple packages with respect to project '[My Project]', targeting '.NETFramework,Version=v4.5.2'

您可以通过以下方式更新.net版本:

right clicking on the project in the solution explorer, 
choosing "Properties"
on the Application Tab (default) from the DropDown list labeled "Target Framework" select 4.5 (or greater - I chose 4.5.2)

您可能不需要重新安装该软件包,但是在检查它是否有效之前,我已经重新安装了该软件包。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章