Skip to content

Commit

Permalink
Refactor BasePagedList<T> and remove PagedListMetaData
Browse files Browse the repository at this point in the history
BasePagedList<T> no longer inherits from PagedListMetaData and now directly implements IPagedList<T>. Added properties (PageCount, TotalItemCount, PageNumber, PageSize, HasPreviousPage, HasNextPage, IsFirstPage, IsLastPage) with protected set accessors to BasePagedList<T>. Removed PagedListMetaData class. Added Subset list of type T to BasePagedList<T> and initialized it as an empty list.
  • Loading branch information
EdiWang committed Oct 31, 2024
1 parent d544d4f commit 985577b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
18 changes: 17 additions & 1 deletion src/Moonglade.Web/PagedList/BasePagedList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,24 @@
/// <typeparam name = "T">The type of object the collection should contain.</typeparam>
/// <seealso cref = "IPagedList{T}" />
/// <seealso cref = "List{T}" />
public class BasePagedList<T> : PagedListMetaData, IPagedList<T>
public class BasePagedList<T> : IPagedList<T>
{
public int PageCount { get; protected set; }

public int TotalItemCount { get; protected set; }

public int PageNumber { get; protected set; }

public int PageSize { get; protected set; }

public bool HasPreviousPage { get; protected set; }

public bool HasNextPage { get; protected set; }

public bool IsFirstPage { get; protected set; }

public bool IsLastPage { get; protected set; }

protected readonly List<T> Subset = [];

/// <summary>
Expand Down
23 changes: 0 additions & 23 deletions src/Moonglade.Web/PagedList/PagedListMetaData.cs

This file was deleted.

0 comments on commit 985577b

Please sign in to comment.