Missing Entity Framework Include(lambda) extension

.NetEntity FrameworkLambda

.Net Problem Overview


The EF OjbectSet.Include(a => a.parent) extension is unavailable. I know I could add code to mimic it, but according to https://stackoverflow.com/questions/14518149/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.

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);

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 https://stackoverflow.com/questions/18208102/database-first-generation-entity-framework-5-system-data-entity-vs-entityframewo . The project is generating a 4.5 assembly.

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.

Any ideas?

.Net Solutions


Solution 1 - .Net

According to MSDN, the method is defined in the EntityFramework assembly. (in EntityFramework.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:

using System.Data.Entity;

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionshannonView Question on Stackoverflow
Solution 1 - .NetKhanView Answer on Stackoverflow