Skip to content

PageImpl<T>

Namespace: SlottyMedia.Database.Pagination

public class PageImpl<T> : IPage`1, , System.Collections.IEnumerable

Type Parameters

T

Inheritance ObjectPageImpl<T>
Implements IPage<T>, IEnumerable<T>, IEnumerable

Properties

Content

public List<T> Content { get; }

Property Value

List<T>

PageNumber

public int PageNumber { get; }

Property Value

Int32

PageSize

public int PageSize { get; }

Property Value

Int32

TotalPages

public int TotalPages { get; }

Property Value

Int32

Constructors

PageImpl(List<T>, Int32, Int32, Int32, Func<Int32, Task<IPage<T>>>)

Creates a page.

public PageImpl(List<T> content, int pageNumber, int pageSize, int totalPages, Func<int, Task<IPage<T>>> callback)

Parameters

content List<T>
The page's content

pageNumber Int32
The number of this page

pageSize Int32
The size of each page

totalPages Int32
The number of total pages

callback Func<Int32, Task<IPage<T>>>
A calback that is used to fetch a page with a specific number

Methods

Map<TMapped>(Func<T, TMapped>)

public IPage<TMapped> Map<TMapped>(Func<T, TMapped> function)

Type Parameters

TMapped

Parameters

function Func<T, TMapped>

Returns

IPage<TMapped>

Fetch(Int32)

public Task<IPage<T>> Fetch(int pageNumber)

Parameters

pageNumber Int32

Returns

Task<IPage<T>>

GetEnumerator()

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

Empty()

Builds an empty page with no content. Throws an InvalidOperationException when attempting to fetch another page.

public static IPage<T> Empty()

Returns

IPage<T>
The empty page