Table of Contents

Class PaginationQueryableExtensions

Namespace
Trellis.EntityFrameworkCore
Assembly
Trellis.EntityFrameworkCore.dll

Forward-only seek pagination. Ordering must end in a stable unique key. Provider translation failures and cancellation propagate; invalid client cursors return InvalidInput. Value-object projections require the Trellis query interceptors.

public static class PaginationQueryableExtensions
Inheritance
PaginationQueryableExtensions
Inherited Members

Methods

ToPageAsync<T, TState>(IQueryable<T>, PageRequest, SeekDefinition<T, TState>, string?, CancellationToken)

Executes a seek from validated request controls.

public static Task<Result<Page<T>>> ToPageAsync<T, TState>(this IQueryable<T> source, PageRequest request, SeekDefinition<T, TState> seek, string? cursorFieldName = null, CancellationToken cancellationToken = default) where T : class where TState : notnull

Parameters

source IQueryable<T>
request PageRequest
seek SeekDefinition<T, TState>
cursorFieldName string
cancellationToken CancellationToken

Returns

Task<Result<Page<T>>>

Type Parameters

T
TState

ToPageAsync<T, TKey>(IQueryable<T>, PageSize, Cursor?, Expression<Func<T, TKey>>, string?, CancellationToken)

Executes a single-key ascending seek using the built-in scalar codec. Codec support is checked before querying. Use an explicit SeekDefinition for custom codecs or composite keys.

public static Task<Result<Page<T>>> ToPageAsync<T, TKey>(this IQueryable<T> source, PageSize pageSize, Cursor? cursor, Expression<Func<T, TKey>> keySelector, string? cursorFieldName = null, CancellationToken cancellationToken = default) where T : class where TKey : notnull, IComparable<TKey>, IParsable<TKey>

Parameters

source IQueryable<T>
pageSize PageSize
cursor Cursor
keySelector Expression<Func<T, TKey>>
cursorFieldName string
cancellationToken CancellationToken

Returns

Task<Result<Page<T>>>

Type Parameters

T
TKey

ToPageAsync<T, TState>(IQueryable<T>, PageSize, Cursor?, SeekDefinition<T, TState>, string?, CancellationToken)

Decodes a boundary, applies its matching composite ordering and seek, over-fetches one row, and assembles a page. This does not create a snapshot or guarantee stability of mutable sort values between requests.

public static Task<Result<Page<T>>> ToPageAsync<T, TState>(this IQueryable<T> source, PageSize pageSize, Cursor? cursor, SeekDefinition<T, TState> seek, string? cursorFieldName = null, CancellationToken cancellationToken = default) where T : class where TState : notnull

Parameters

source IQueryable<T>
pageSize PageSize
cursor Cursor
seek SeekDefinition<T, TState>
cursorFieldName string
cancellationToken CancellationToken

Returns

Task<Result<Page<T>>>

Type Parameters

T
TState