'IQueryable' does not contain a definition for 'Include'

Viewed 27

The literal message of the error is "'IQueryable' does not contain a definition for 'Include' and no accessible extension method 'Include' accepting a first argument of type 'IQueryable' could be found (are you missing a using directive or an assembly reference?)".

I'm upgrading from EF to EFCore6. The current include() method comes from System.Data.Entity.QueryableExtensions.Include().

And I found out the the most alike method is located in Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.Include().

However the signatures are different. EF: (System.Data.Entity.QueryableExtensions) public static IQueryable Include(this IQueryable source, string path)

EFCore6: (Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions) public static IQueryable Include(this IQueryable source, [NotParameterized] string navigationPropertyPath) where TEntity : class

The problem is that I'm trying to build a generic library, so I cannot use a specify TEntity class.

Does anyone have any idea?

Thank in advanced.

0 Answers
Related