/// <summary> /// Get specific page from original SqlSugarQueryable source /// </summary> /// <typeparam name="T">element type of your SqlSugarQueryable source</typeparam> /// <param name="query">original SqlSugarQueryable source</param> /// <param name="pageNumber">page number</param> /// <param name="pageSize">page size</param> /// <returns></returns> public static IPage <T> GetPage <T>(this ISugarQueryable <T> query, int pageNumber, int pageSize) { if (query == null) { throw new ArgumentNullException(nameof(query), $"{nameof(query)} can not be null."); } if (pageNumber < 0) { throw new IndexOutOfRangeException($"{nameof(pageNumber)} can not be less than zero"); } if (pageSize < 0) { throw new IndexOutOfRangeException($"{nameof(pageSize)} can not be less than zero"); } return(new SqlSugarPage <T>(query, pageNumber, pageSize, SqlSugarHelper.Count(query))); }