UnitOfWork icon indicating copy to clipboard operation
UnitOfWork copied to clipboard

GetPagedList orderBy parameter

Open BrianARice opened this issue 5 years ago • 2 comments

My database table Plan has a column called SortBy that I want to use to order the request... the below code is giving me the error: 'IQueryable<Plan>' does not contain a definition for 'SortBy' and no accessible extension method 'SortBy' accepting a first argument of type 'IQueryable<Plan>' could be found (are you missing a using directive or an assembly reference?)

        var repoPlan = _unitOfWork.GetRepository<Plan>();
        var list = repoPlan.GetPagedList(predicate: p => p.IsActive == true, orderBy: p => p.SortBy, pageIndex: skip, pageSize: take);

Any help on how to do this properly?

BrianARice avatar Oct 22 '20 15:10 BrianARice

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

issue-label-bot[bot] avatar Oct 22 '20 15:10 issue-label-bot[bot]

using System.Linq;

...

repo.GetPagedList(orderBy: x => x.OrderBy(p => p.SortBy));
...

VergilGao avatar Jan 05 '21 06:01 VergilGao