0
kapil created
- ABP Framework version: v5.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:"
- when i upgrade project from 4.4.4 to 5.2 i have faced issue in Repository.
- In 4.4.4 this code is working fine
- var query = Repository.Include(r => r.LayerFields).Where(a => a.LayerName.Equals(tempLayerDto.LayerName));
- In 4.4.4 this code is working fine
but in 5.2 i upgrdae them its show error ->Error: IRepository<TempLayer, Guid>' does not contain a definition for 'Include' and no accessible extension method 'Include' accepting a first argument of type 'IRepository<TempLayer, Guid>' could be found (are you missing a using directive or an assembly reference?)
1 Answer(s)
-
0
Hi,
IRepository
doesn't inherit fromIQueryable
anymore. (See related blog post) So you need to obtainIQueryable
for your repository to be able to use LINQ methods, the recommended way is usingIRepository.GetQueryableAsync()
to obtain anIQueryable
.- So you can change your code as below.
var queryable = await Repository.GetQueryableAsync(); //obtain IQueryable var query = queryable.Include(r => r.LayerFields).Where(a => a.LayerName.Equals(tempLayerDto.LayerName));
https://docs.abp.io/en/abp/5.3/Repositories#querying-linq-over-the-repositories