Ejemplo n.º 1
0
        public static IQueryable <T> ApplyPaging <T>(this IOrderedQueryable <T> query, int currentPage, int pageSize,
                                                     out int pageCount, out int queryCount)
        {
            Tracer.Verbose(() => "applying query paging");

            pageCount = query.CalculatePageCount(pageSize, out queryCount);

            if (pageSize == 0)
            {
                Tracer.Verbose(() => "paging is disabled");
                return(query);
            }

            Tracer.Verbose(() => "building paged query");
            return(query.Skip((currentPage - 1) * pageSize).Take(pageSize));
        }