我创建了以下类来使所有查询分页,但我不知道如何使最终查询异步,SqlKata 可以吗?
public class PagedList<T> : List<T>
{
public int CurrentPage { get; set; }
public int TotalPages { get; set; }
public int PageSize { get; set; }
public int TotalCount { get; set; }
public PagedList(List<T> items, int totalCount, int pageNumber, int pageSize)
{
TotalCount = totalCount;
PageSize = pageSize;
CurrentPage = pageNumber;
TotalPages = (int)Math.Ceiling(totalCount / (double)pageSize);
this.AddRange(items);
}
public static async Task<PagedList<T>> CreateAsync(Query query, int pageNumber, int pageSize)
{
var count = query.AsCount();
var items = query.Skip((pageNumber - 1) * pageSize).Take(pageSize).???;
}
}
因此,在最后一个查询中的“Take(pageSize)”之后,我看不到 SelectAsync 或 GetAsync。知道怎么做吗?