예제 #1
0
        /// <summary>
        /// Async static method to create a new instance of the <see cref="AsyncPagedList{T}
        /// </summary>
        /// <param name="superset"></param>
        /// <param name="pageNumber"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public static async Task <AsyncPagedList <T> > CreateAsync(IQueryable <T> superset, int pageNumber, int pageSize)
        {
            var pagedList = new AsyncPagedList <T>();
            await pagedList.InitAsync(superset, pageNumber, pageSize).ConfigureAwait(false);

            return(pagedList);
        }
예제 #2
0
 /// <summary>
 /// Async Extension method to return a paged results
 /// </summary>
 /// <typeparam name="T">Document Type</typeparam>
 /// <param name="queryable">Extension point on <see cref="IQueryable{T}"/></param>
 /// <param name="pageNumber">One based page number</param>
 /// <param name="pageSize">Page size</param>
 /// <param name="token">Cancellation token</param>
 /// <returns>return paged result</returns>
 public static async Task <IPagedList <T> > AsPagedListAsync <T>(
     this IQueryable <T> queryable,
     int pageNumber,
     int pageSize,
     CancellationToken token = default(CancellationToken))
 {
     // return paged list
     return(await AsyncPagedList <T> .CreateAsync(queryable, pageNumber, pageSize).ConfigureAwait(false));
 }