Вопрос

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.

Это было полезно?

Решение

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.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top