Table of Contents

Class PaginationExtensions

Namespace
Olve.Utilities.Paginations
Assembly
Olve.Utilities.dll

Applies a Pagination or OffsetPagination to a sequence.

public static class PaginationExtensions
Inheritance
PaginationExtensions
Inherited Members

Methods

Paginate<T>(IEnumerable<T>, OffsetPagination)

Returns the slice of source described by pagination, together with the total number of items in source.

public static Slice<T> Paginate<T>(this IEnumerable<T> source, OffsetPagination pagination)

Parameters

source IEnumerable<T>

The items to paginate. Enumerated once.

pagination OffsetPagination

The slice to take.

Returns

Slice<T>

The requested slice.

Type Parameters

T

The type of the items.

Exceptions

ArgumentOutOfRangeException

Offset is negative, or Limit is zero or negative.

Paginate<T>(IEnumerable<T>, Pagination)

Returns the page of source described by pagination, together with the total number of items in source.

public static Page<T> Paginate<T>(this IEnumerable<T> source, Pagination pagination)

Parameters

source IEnumerable<T>

The items to paginate. Enumerated once.

pagination Pagination

The page to take.

Returns

Page<T>

The requested page.

Type Parameters

T

The type of the items.

Exceptions

ArgumentOutOfRangeException

Page is negative, or PageSize is zero or negative.

Paginate<T>(IQueryable<T>, OffsetPagination)

Returns the slice of source described by pagination, together with the total number of items in source. The count, skip and take are composed onto the query, so query providers such as Entity Framework translate them.

public static Slice<T> Paginate<T>(this IQueryable<T> source, OffsetPagination pagination)

Parameters

source IQueryable<T>

The query to paginate. Executed twice: once to count, once to fetch the slice.

pagination OffsetPagination

The slice to take.

Returns

Slice<T>

The requested slice.

Type Parameters

T

The type of the items.

Exceptions

ArgumentOutOfRangeException

Offset is negative, or Limit is zero or negative.

Paginate<T>(IQueryable<T>, Pagination)

Returns the page of source described by pagination, together with the total number of items in source. The count, skip and take are composed onto the query, so query providers such as Entity Framework translate them.

public static Page<T> Paginate<T>(this IQueryable<T> source, Pagination pagination)

Parameters

source IQueryable<T>

The query to paginate. Executed twice: once to count, once to fetch the page.

pagination Pagination

The page to take.

Returns

Page<T>

The requested page.

Type Parameters

T

The type of the items.

Exceptions

ArgumentOutOfRangeException

Page is negative, or PageSize is zero or negative.