Walkthrough Generated Code Get Paged List

BasicCRUD Part 2

Now let us walk through the generated code for the GetPagedList. Lets look at the output api model.

public class GetCustomersOutputAPIModel : IFlexOutputAPIModel
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public DateTime DateOfBirth { get; set; }
    }

The GetPagedList is the same as the GetList. The only difference is it does the paging for you on the server-side.

public override FlexiPagedList<GetCustomersOutputAPIModel> Fetch()
        {
            ..........
            ..........
            
            var result = BuildPagedOutput(projection);
            
            ..........

            return result;
        }
protected override IQueryable<T> Build<T>()
        {

            ..............
            ..............

            query = CreatePagedQuery<T>(query, _params.PageNumber, _params.PageSize);

            return query;
        }

So this is the only difference the query executes and whatever the query result is there it appends the paging algorithm to the query so that you get the query from the server-side itself.

Last updated