Question

Was DbExtensions lib not included for EF 6.0? I have a generic repo that returns and IQueryable and I'd like to be able to call .Include(i => i.SomeEntity) on demaind when needed.

Was it helpful?

Solution

I'm going to answer my own question. You don't make a reference to System.Data.Entity for version 6 to get the DbExtensions. You need to reference the EntityFramework itself and add using System.Data.Entity at the top of your cs file and the .Include() will be there.

OTHER TIPS

For EF 6.0 these functions are now available in System.Data.Entity.QueryableExtensions within EntityFramework.dll:

public static IQueryable Include(this IQueryable source, string path);

public static IQueryable<T> Include<T>(this IQueryable<T> source, string path);

public static IQueryable<T> Include<T, TProperty>(this IQueryable<T> source, Expression<Func<T, TProperty>> path);

Add using System.Data.Entity;.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top