Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageData.cs:修复 PagedData 无法正确序列化问题;添加新增 Empty 属性用于获取默认实例 #122

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/NetCorePal.Extensions.Dto/PagedData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Text.Json.Serialization;

namespace NetCorePal.Extensions.Dto;
namespace NetCorePal.Extensions.Dto;

/// <summary>
/// 分页数据模型
Expand All @@ -15,7 +13,6 @@ public class PagedData<T>
/// <param name="total">总数据条数</param>
/// <param name="pageIndex">当前页码,从1开始</param>
/// <param name="pageSize">每页条数</param>
[JsonConstructor]
public PagedData(IEnumerable<T> items, int total, int pageIndex, int pageSize)
{
Items = items;
Expand All @@ -24,10 +21,10 @@ public PagedData(IEnumerable<T> items, int total, int pageIndex, int pageSize)
PageSize = pageSize;
}

public PagedData()
{
Items = [];
}
/// <summary>
/// 表示一个空的 <see cref="PagedData{T}"/> 实例。
/// </summary>
public static PagedData<T> Empty => new([], 0, 0, 0);

/// <summary>
/// 分页数据
Expand Down
Loading