dotnetcore / dotnetcore/FreeSql
希望分页中加入页数量(PageCount)属性,不用每次自己计算
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 910
- PR merge metrics
- No merged PRs in 30d
Description
问题点,好多分页控件需要的参数为 页大小 (PageCount)而不是 总数量(Count)导致我每次都需要自己去计算页大小,确实较麻烦。
希望将 PagingInfo 类加入到 FreeSql 中
```
public class PagingInfo : BasePagingInfo
{
public PagingInfo(int pageNumber, int pageSize = 20) : base()
{
base.PageNumber = pageNumber;
base.PageSize = pageSize;
}
///
/// 页大小
///
public int PageCount { get => Math.Max(1, (int)Math.Ceiling(Count / (double)PageSize)); }
}
```
使用方式
```
PagingInfo pagingInfo = new PagingInfo(PageIndex, PageSize);
DataList = await DataDb.db.Queryable().Page(pagingInfo).ToListAsync();
PageCount = pagingInfo.PageCount;
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the existing PagingInfo and BasePagingInfo types and the Page query entry point. Confirm how Count and PageSize are exposed, then add the requested PageCount behavior and verify it through the project’s existing pagination tests or query tests, if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, database
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100