I can't call the new QueryableExtensions
(ToListAsync
, ForEachAsync
,...) provided with EntityFramework 6. But i can call others (Include
, Intersect
).
I've a reference to System.Data.Entity
.
So apparently, i've an older version of System.Data.Entity
, with the latest version of EntityFramework. Is it possible?
My code does not compile and I cannot see the ForEachAsync
method in the object browser.
I'm working with Visual Studio 2013, .Net 4.5, EntityFramework 6.1.3, Wpf.
Edit
Entity framework is installed :
I've tried to Uninstall then Reinstall package many times, with a restart of visual studio. Still not working
Edit
In another project (referenced by this one), I can see the IQueryableExtensions
needed in the object browser. If I add this project to my solution (before it was only a reference), the IQueryableExtensions
needed are missing in the object browser.
One of your projects is probably targeting an older version of the .net framework.
I had this issue when a project was targeting .Net v4.0, update it to 4.5 or newer. I also ran the command that others recommended after this.
You can see what version of .Net is is targeting when you run the update-package command in the package console. For example output from my project when it was targeting 4.0
and then with v4.5.2:
You update your .net version by:
There is a chance you don't need to reinstall the package, however I reinstalled before checking if it worked.
Probably you have installed EntityFramework package when your project was targeting .NET v4.0. Even though you have migrated your project to .NET v4.5, the
QueryableExtensions
class still does not contain the async methods because the package was installed before migration.Just reinstall the Entity Framework package.
You need to reference the
EntityFramework.dll
. Remove the reference toSystem.Data.Entity.dll
manually (if it is present).Take a look at QueryableExtensions on MSDN
With Nuget it should be simple, cause this will add the dependencies fro you
or use the update command
This will install the latest version of Entity Framework (6.1.3)