Public .NET API ReferenceL2 Cross-Cutting & ReliabilityStableAOT: Partial

EricksonLopez.Pagination

A flexible and easy-to-use pagination library for .NET applications, providing reusable components and seamless integration with modern web APIs.

17 namespaces119 types424 membersGenerated from XML docs & assemblies · UTC 2026-12-01

Showing 119 of 119 types (424 members)

EricksonLopez.Pagination#

20
class

Base64CursorEncoder

Assembly: EricksonLopez.Pagination
public sealed class Base64CursorEncoder : ICursorEncoder
Implements: ICursorEncoder

Encapsulates a Base64-based cursor encoder that transforms cursor strings into URL-safe Base64 representations.

Members (3)

  • methodDecode
    public string? Decode(string? opaqueCursor)

    Decodes an opaque cursor string back into its raw value.

    opaqueCursor: string?
    The opaque cursor string to decode.

    Returns: The raw, decoded cursor value, or `null` if the input is null or empty.

    Exceptions: InvalidPaginationCursorException: `opaqueCursor` is not a valid Base64-encoded string

  • methodEncode
    public string? Encode(string? rawCursor)

    Encodes a raw cursor string into an opaque cursor string.

    rawCursor: string?
    The raw cursor value to encode.

    Returns: The opaque, encoded cursor string, or `null` if the input is null or empty.

  • propertyDefault
    public static Base64CursorEncoder Default { get; }

    Gets the singleton default instance of `Base64CursorEncoder`.

class

CountedCursorPagedList<T>

Assembly: EricksonLopez.Pagination
public sealed class CountedCursorPagedList<T> : CursorPagedList<T>, ICountedCursorPagedList<T>
Inherits: CursorPagedList<T>Implements: ICountedCursorPagedList<T>

Represents an immutable paginated list with cursor-based metadata and an exact total count.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (4)

  • constructorCountedCursorPagedList
    public CountedCursorPagedList(IReadOnlyList<T> items, long totalCount, string? startCursor, string? endCursor, bool hasPreviousPage, bool hasNextPage)

    Initializes a new instance of the `CountedCursorPagedList<T>` class with the specified items, total count, and cursor metadata.

    items: IReadOnlyList<T>
    The materialized page of items.
    totalCount: long
    The exact total number of items across all pages.
    startCursor: string?
    The encoded opaque cursor for the first item, or `null` if the page is empty.
    endCursor: string?
    The encoded opaque cursor for the last item, or `null` if the page is empty.
    hasPreviousPage: bool
    `true` if there is a page before this one; otherwise, `false`.
    hasNextPage: bool
    `true` if there is a page after this one; otherwise, `false`.
  • methodMap<TResult>
    public new CountedCursorPagedList<TResult> Map<TResult>(Func<T, TResult> selector)

    Projects each element of the paginated list into a new form using the specified transform function, preserving cursor metadata and the total count.

    selector: Func<T, TResult>
    A transform function to apply to each element.

    Returns: A new `CountedCursorPagedList<TResult>` containing the transformed elements and preserved metadata.

    Type parameters: TResult: The type of elements in the resulting list. Exceptions: ArgumentNullException: `selector` is `null`

  • propertyExactTotalCount
    public long ExactTotalCount { get; }

    Gets the exact total number of items across all pages.

  • propertyTotalCount
    public long? TotalCount { get; }

    Gets the total number of items across all pages, or `null` if not computed.

class

CountedPagedList<T>

Assembly: EricksonLopez.Pagination
public sealed class CountedPagedList<T> : PagedList<T>, ICountedPagedList<T>
Inherits: PagedList<T>Implements: ICountedPagedList<T>

Represents an immutable paginated list with a known total count.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (2)

  • methodMap<TResult>
    public new CountedPagedList<TResult> Map<TResult>(Func<T, TResult> selector)

    Projects each element of the counted paginated list into a new form using the specified transform function, preserving the total count.

    selector: Func<T, TResult>
    A transform function to apply to each element.

    Returns: A new `CountedPagedList<TResult>` containing the transformed elements and preserved count metadata.

    Type parameters: TResult: The type of elements in the resulting list. Exceptions: ArgumentNullException: `selector` is `null`

  • propertyExactTotalCount
    public long ExactTotalCount { get; }

    Gets the exact total number of items across all pages.

class

CursorPagedList<T>

Assembly: EricksonLopez.Pagination
public class CursorPagedList<T> : ICursorPagedList<T>
Implements: ICursorPagedList<T>

Represents an immutable paginated list with cursor-based metadata.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (11)

  • constructorCursorPagedList
    public CursorPagedList(IReadOnlyList<T> items, string? startCursor, string? endCursor, bool hasPreviousPage, bool hasNextPage)

    Initializes a new instance of the `CursorPagedList<T>` class with the specified items and cursor metadata.

    items: IReadOnlyList<T>
    The collection of elements contained in the current page.
    startCursor: string?
    The encoded opaque cursor pointing to the first item in the page, or `null` if empty.
    endCursor: string?
    The encoded opaque cursor pointing to the last item in the page, or `null` if empty.
    hasPreviousPage: bool
    `true` if a preceding page exists; otherwise, `false`.
    hasNextPage: bool
    `true` if a subsequent page exists; otherwise, `false`.
  • methodCreate
    public static CursorPagedList<T> Create(IReadOnlyList<T> items, string? startCursor, string? endCursor, bool hasPreviousPage, bool hasNextPage)

    Creates a new `CursorPagedList<T>` from the specified items and cursor metadata.

    items: IReadOnlyList<T>
    The collection of elements contained in the current page.
    startCursor: string?
    The encoded opaque cursor pointing to the first item in the page, or `null` if empty.
    endCursor: string?
    The encoded opaque cursor pointing to the last item in the page, or `null` if empty.
    hasPreviousPage: bool
    `true` if a preceding page exists; otherwise, `false`.
    hasNextPage: bool
    `true` if a subsequent page exists; otherwise, `false`.

    Returns: A new `CursorPagedList<T>` containing the specified elements and metadata.

    Exceptions: ArgumentNullException: `items` is `null`

  • methodGetEnumerator
    public IEnumerator<T> GetEnumerator()

    Inherits documentation from base type or interface.

  • methodMap<TResult>
    public virtual CursorPagedList<TResult> Map<TResult>(Func<T, TResult> selector)

    Projects each element of the paginated list into a new form using the specified transform function, preserving cursor metadata.

    selector: Func<T, TResult>
    A transform function to apply to each element.

    Returns: A new `CursorPagedList<TResult>` containing the transformed elements and preserved metadata.

    Type parameters: TResult: The type of elements contained in the projected page. Exceptions: ArgumentNullException: `selector` is `null`

  • propertyCount
    public int Count { get; }

    Inherits documentation from base type or interface.

  • propertyEndCursor
    public string? EndCursor { get; }

    Gets the opaque cursor to the last item in the current page.

  • propertyHasNextPage
    public bool HasNextPage { get; }

    Gets a value indicating whether there is a page after the current one.

  • propertyHasPreviousPage
    public bool HasPreviousPage { get; }

    Gets a value indicating whether there is a page before the current one.

  • propertyStartCursor
    public string? StartCursor { get; }

    Gets the opaque cursor to the first item in the current page.

  • propertythis[int index]
    public T this[int index] { get; }

    Inherits documentation from base type or interface.

    index: int
  • fieldEmpty
    public static readonly CursorPagedList<T> Empty

    Represents an empty cursor-paginated list with no items or cursors.

class

CursorPaginationParametersExtensions

Assembly: EricksonLopez.Pagination
public static class CursorPaginationParametersExtensions

Provides extension methods for decoding cursors from `CursorPaginationParameters`.

Members (8)

  • methodDecodeAfter<TKey>
    public static TKey? DecodeAfter<TKey>(this CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null) where TKey : struct

    Decodes and parses the forward pagination cursor into the specified value type.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT-safe decoders.

    Returns: The parsed key, or `null` if no forward cursor is present.

    Type parameters: TKey: The value type of the cursor key. Exceptions: InvalidPaginationCursorException: The cursor format is invalid or cannot be parsed

  • methodDecodeAfterReference<TKey>
    public static TKey? DecodeAfterReference<TKey>(this CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null) where TKey : class

    Decodes and parses the forward pagination cursor into the specified reference type.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT-safe decoders.

    Returns: The parsed key instance, or `null` if no forward cursor is present.

    Type parameters: TKey: The reference type of the cursor key. Exceptions: InvalidPaginationCursorException: The cursor format is invalid or cannot be parsed

  • methodDecodeAfterString
    public static string? DecodeAfterString(this CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder = null)

    Decodes the forward pagination cursor into a plain string representation.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.

    Returns: The decoded plain string, or `null` if no forward cursor is present.

  • methodDecodeBefore<TKey>
    public static TKey? DecodeBefore<TKey>(this CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null) where TKey : struct

    Decodes and parses the backward pagination cursor into the specified value type.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT-safe decoders.

    Returns: The parsed key, or `null` if no backward cursor is present.

    Type parameters: TKey: The value type of the cursor key. Exceptions: InvalidPaginationCursorException: The cursor format is invalid or cannot be parsed

  • methodDecodeBeforeReference<TKey>
    public static TKey? DecodeBeforeReference<TKey>(this CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null) where TKey : class

    Decodes and parses the backward pagination cursor into the specified reference type.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT-safe decoders.

    Returns: The parsed key instance, or `null` if no backward cursor is present.

    Type parameters: TKey: The reference type of the cursor key. Exceptions: InvalidPaginationCursorException: The cursor format is invalid or cannot be parsed

  • methodDecodeBeforeString
    public static string? DecodeBeforeString(this CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder = null)

    Decodes the backward pagination cursor into a plain string representation.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.

    Returns: The decoded plain string, or `null` if no backward cursor is present.

  • methodTryDecodeAfter<TKey>
    public static bool TryDecodeAfter<TKey>(this CursorPaginationParameters parameters, out TKey? value, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null)

    Attempts to decode and parse the forward pagination cursor into the specified key type.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    value: out TKey?
    When this method returns, contains the parsed key if decoding succeeded; otherwise, the default value.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT-safe decoders.

    Returns: `true` if the cursor was successfully decoded and parsed; otherwise, `false`.

    Type parameters: TKey: The type of the cursor key. Exceptions: InvalidPaginationCursorException: The cursor format is invalid or cannot be parsed

  • methodTryDecodeBefore<TKey>
    public static bool TryDecodeBefore<TKey>(this CursorPaginationParameters parameters, out TKey? value, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null)

    Attempts to decode and parse the backward pagination cursor into the specified key type.

    parameters: this CursorPaginationParameters
    The cursor pagination parameters containing the cursor.
    value: out TKey?
    When this method returns, contains the parsed key if decoding succeeded; otherwise, the default value.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT-safe decoders.

    Returns: `true` if the cursor was successfully decoded and parsed; otherwise, `false`.

    Type parameters: TKey: The type of the cursor key. Exceptions: InvalidPaginationCursorException: The cursor format is invalid or cannot be parsed

class

DefaultPagedListFactory

Assembly: EricksonLopez.Pagination
public sealed class DefaultPagedListFactory : IPagedListFactory, ICursorPagedListFactory
Implements: ICursorPagedListFactory, IPagedListFactory

Provides the default implementation of `IPagedListFactory` and `ICursorPagedListFactory`.

Members (3)

  • methodCreateCursorPagedList<T>
    public ICursorPagedList<T> CreateCursorPagedList<T>(IReadOnlyList<T> items, long? totalCount, string? startCursor, string? endCursor, bool hasPreviousPage, bool hasNextPage)

    Creates a new cursor-based paginated list containing the specified items and pagination metadata.

    items: IReadOnlyList<T>
    The items on the current page.
    totalCount: long?
    The optional total number of items across all pages.
    startCursor: string?
    The opaque cursor of the first item in the page.
    endCursor: string?
    The opaque cursor of the last item in the page.
    hasPreviousPage: bool
    A value indicating whether a preceding page exists.
    hasNextPage: bool
    A value indicating whether a subsequent page exists.

    Returns: A new `ICursorPagedList<T>` instance containing the specified elements and metadata.

    Type parameters: T: The type of elements in the page.

  • methodCreatePagedList<T>
    public IPagedList<T> CreatePagedList<T>(IReadOnlyList<T> items, long? totalCount, int page, int pageSize, bool? hasNextPage)

    Creates a new offset-based paginated list containing the specified items and pagination metadata.

    items: IReadOnlyList<T>
    The collection of items on the current page.
    totalCount: long?
    The total number of items across all pages, or `null` if uncounted.
    page: int
    The current 1-indexed page number.
    pageSize: int
    The number of items per page.
    hasNextPage: bool?
    A value indicating whether a subsequent page exists, or `null` if derived from total count.

    Returns: A new `IPagedList<T>` instance containing the specified elements and metadata.

    Type parameters: T: The type of elements in the page.

  • fieldInstance
    public static readonly DefaultPagedListFactory Instance

    Represents the singleton instance of `DefaultPagedListFactory`.

enum

FilterUnknownFieldBehavior

Assembly: EricksonLopez.Pagination
public enum FilterUnknownFieldBehavior

Specifies the behavior when a filter parameter references a field that does not exist on the target entity.

Members (2)

  • fieldIgnore
    Ignore = 0

    Ignores unknown fields and continues evaluating remaining filters.

  • fieldThrowException
    ThrowException = 1

    Throws an exception when an unknown field is encountered.

class

HmacCursorEncoder

Assembly: EricksonLopez.Pagination
public sealed class HmacCursorEncoder : ICursorEncoder, IDisposable
Implements: ICursorEncoder, IDisposable

Provides HMAC-SHA256 signing and verification of cursor values to prevent tampering.

Remarks:

DI Lifetime: When registered as a Singleton in Dependency Injection, the DI container will automatically manage its lifetime and safely call `Dispose()` during shutdown.

Members (5)

  • constructorHmacCursorEncoder
    public HmacCursorEncoder(string secretKey, ICursorEncoder? innerEncoder = null, TimeSpan? timeToLive = null, TimeSpan? clockSkewTolerance = null, ICursorReplayStore? replayStore = null, Microsoft.Extensions.Logging.ILogger? logger = null, Func<string?>? tenantContextProvider = null)

    Initializes a new instance of the `HmacCursorEncoder` class with the specified secret key and optional security settings.

    secretKey: string
    The secret key used for HMAC-SHA256 signing. Must be at least 32 bytes after UTF-8 encoding.
    innerEncoder: ICursorEncoder?
    The underlying encoder used to format the signed payload. Defaults to `Base64CursorEncoder.Default`.
    timeToLive: TimeSpan?
    An optional time-to-live duration for cursor expiration.
    clockSkewTolerance: TimeSpan?
    An optional tolerance for clock skew in distributed environments. Defaults to 30 seconds.
    replayStore: ICursorReplayStore?
    An optional replay store for single-use cursor validation.
    logger: Microsoft.Extensions.Logging.ILogger?
    An optional logger for cursor security and expiration events.
    tenantContextProvider: Func<string?>?
    An optional provider for current tenant context to scope cursors to tenants.

    Exceptions: ArgumentNullException: `secretKey` is `null`; ArgumentException: `secretKey` is shorter than 32 bytes after UTF-8 encoding

  • methodDecode
    public string? Decode(string? opaqueCursor)

    Decodes an opaque cursor string back into its raw value.

    opaqueCursor: string?
    The opaque cursor string to decode.

    Returns: The raw, decoded cursor value, or `null` if the input is null or empty.

    Exceptions: ObjectDisposedException: The encoder has been disposed; InvalidPaginationCursorException: The cursor signature is invalid, missing a nonce, or tampering was detected; ExpiredPaginationCursorException: The cursor has expired according to its time-to-live; ReplayedPaginationCursorException: The cursor has already been consumed and replay was detected

  • methodDispose
    public void Dispose()

    Releases the unmanaged resources used by the `HmacCursorEncoder` and clears sensitive key material.

  • methodEncode
    public string? Encode(string? rawCursor)

    Encodes a raw cursor string into an opaque cursor string.

    rawCursor: string?
    The raw cursor value to encode.

    Returns: The opaque, encoded cursor string, or `null` if the input is null or empty.

    Exceptions: ObjectDisposedException: The encoder has been disposed

  • propertyDevelopmentDefault
    public static HmacCursorEncoder DevelopmentDefault { get; }

    Gets a fallback HMAC encoder instance configured with a development key.

interface

ICursorEncoder

Assembly: EricksonLopez.Pagination
public interface ICursorEncoder

Defines a contract for encoding and decoding opaque pagination cursors.

Members (2)

  • methodDecode
    string? Decode(string? opaqueCursor)

    Decodes an opaque cursor string back into its raw value.

    opaqueCursor: string?
    The opaque cursor string to decode.

    Returns: The raw, decoded cursor value, or `null` if the input is null or empty.

    Exceptions: InvalidPaginationCursorException: `opaqueCursor` is malformed or cannot be decoded

  • methodEncode
    string? Encode(string? rawCursor)

    Encodes a raw cursor string into an opaque cursor string.

    rawCursor: string?
    The raw cursor value to encode.

    Returns: The opaque, encoded cursor string, or `null` if the input is null or empty.

class

ICursorPagedListExtensions

Assembly: EricksonLopez.Pagination
public static class ICursorPagedListExtensions

Provides extension methods for `ICursorPagedList<T>` instances.

Members (1)

  • methodMap<TSource, TResult>
    public static ICursorPagedList<TResult> Map<TSource, TResult>(this ICursorPagedList<TSource> source, Func<TSource, TResult> selector)

    Projects each element of a cursor-paginated list into a new form using the specified transform function.

    source: this ICursorPagedList<TSource>
    The cursor-paginated list to transform.
    selector: Func<TSource, TResult>
    A transform function to apply to each element.

    Returns: A new `ICursorPagedList<TResult>` containing the transformed elements and preserved cursor metadata.

    Type parameters: TSource: The type of elements in the source list.; TResult: The type of elements in the resulting list. Exceptions: ArgumentNullException: `source` or `selector` is `null`

class

InMemoryCursorDecoderRegistry

Assembly: EricksonLopez.Pagination
public sealed class InMemoryCursorDecoderRegistry : ICursorDecoderRegistry
Implements: ICursorDecoderRegistry

Provides an in-memory, thread-safe implementation of `ICursorDecoderRegistry`.

Remarks:

This type is thread-safe and suitable for singleton lifetime registration.

Members (4)

  • methodClear
    public void Clear()

    Removes all registered decoders from the registry.

  • methodRegister<TKey>
    public void Register<TKey>(Func<string, TKey> decoder)

    Registers a cursor decoder delegate for the specified key type.

    decoder: Func<string, TKey>
    The function that converts an opaque cursor string to a `TKey` value.

    Type parameters: TKey: The cursor key type handled by this decoder.

  • methodTryGetDecoder<TKey>
    public bool TryGetDecoder<TKey>(out Func<string, TKey>? decoder)

    Attempts to retrieve a registered cursor decoder for the specified key type.

    decoder: out Func<string, TKey>?
    When this method returns, contains the registered decoder function if found; otherwise, `null`.

    Returns: `true` if a decoder for `TKey` is registered; otherwise, `false`.

    Type parameters: TKey: The cursor key type to decode.

  • methodUnregister<TKey>
    public bool Unregister<TKey>()

    Removes the registered cursor decoder for the specified key type.

    Returns: `true` if the decoder was found and removed; otherwise, `false`.

    Type parameters: TKey: The cursor key type whose decoder should be removed.

class

InMemoryCursorReplayStore

Assembly: EricksonLopez.Pagination
public sealed class InMemoryCursorReplayStore : ICursorReplayStore
Implements: ICursorReplayStore

Provides an in-memory, thread-safe implementation of `ICursorReplayStore`.

Remarks:

Deployment Note: This store operates entirely within the local process memory. It is suitable for single-node deployments, integration tests, and local development. For multi-node or clustered environments (e.g. Kubernetes with multiple replicas), use a distributed implementation of `ICursorReplayStore` (such as Redis or a shared database store) to ensure nonces are synchronized across all running instances.

Members (2)

  • methodTryAcquireNonce
    public bool TryAcquireNonce(string nonce, TimeSpan timeToLive)

    Attempts to acquire and record a cursor nonce.

    nonce: string
    The unique nonce string embedded within the cursor.
    timeToLive: TimeSpan
    The duration for which the nonce must be retained in the store.

    Returns: `true` if the nonce was fresh and successfully recorded; otherwise, `false` if it was previously consumed.

    Exceptions: ArgumentNullException: `nonce` is `null`

  • methodTryAcquireNonceAsync
    public Task<bool> TryAcquireNonceAsync(string nonce, TimeSpan timeToLive, CancellationToken cancellationToken = default)

    Attempts to acquire and record a cursor nonce asynchronously.

    nonce: string
    The unique nonce string embedded within the cursor.
    timeToLive: TimeSpan
    The duration for which the nonce must be retained in the store.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains `true` if the nonce was fresh and successfully recorded; otherwise, `false` if it was previously consumed.

class

PagedListExtensions

Assembly: EricksonLopez.Pagination
public static class PagedListExtensions

Provides extension methods for `IPagedList<T>` and `ICountedPagedList<T>` instances.

Members (3)

  • methodLazyMap<TSource, TResult>
    public static IPagedList<TResult> LazyMap<TSource, TResult>(this IPagedList<TSource> source, Func<TSource, TResult> selector)

    Projects each element of a paginated list into a new form using deferred evaluation without allocating an array upfront.

    source: this IPagedList<TSource>
    The paginated list to transform.
    selector: Func<TSource, TResult>
    A transform function to apply to each source element.

    Returns: An `IPagedList<TResult>` whose elements are projected lazily on enumeration or indexing.

    Type parameters: TSource: The type of elements in the source list.; TResult: The type of elements in the resulting list. Exceptions: ArgumentNullException: `source` or `selector` is `null`

  • methodMap<TSource, TResult>
    public static ICountedPagedList<TResult> Map<TSource, TResult>(this ICountedPagedList<TSource> source, Func<TSource, TResult> selector)

    Projects each element of a counted paginated list into a new form, immediately materializing the projected elements and preserving total count metadata.

    source: this ICountedPagedList<TSource>
    The counted paginated list to transform.
    selector: Func<TSource, TResult>
    A transform function to apply to each element.

    Returns: A new `ICountedPagedList<TResult>` containing the projected elements and preserved count metadata.

    Type parameters: TSource: The type of elements in the source page.; TResult: The type of elements in the projected page. Exceptions: ArgumentNullException: `source` or `selector` is `null`

  • methodMap<TSource, TResult>
    public static IPagedList<TResult> Map<TSource, TResult>(this IPagedList<TSource> source, Func<TSource, TResult> selector)

    Projects each element of a paginated list into a new form, immediately materializing the projected elements into a new list.

    source: this IPagedList<TSource>
    The paginated list to transform.
    selector: Func<TSource, TResult>
    A transform function to apply to each element.

    Returns: A new `IPagedList<TResult>` containing the projected elements.

    Type parameters: TSource: The type of elements in the source page.; TResult: The type of elements in the projected page. Exceptions: ArgumentNullException: `source` or `selector` is `null`

class

PagedList<T>

Assembly: EricksonLopez.Pagination
public class PagedList<T> : IPagedList<T>
Implements: IPagedList<T>

Represents an immutable paginated list providing offset-based pagination metadata.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (13)

  • methodEmpty
    public static CountedPagedList<T> Empty(PaginationParameters parameters)

    Creates an empty `CountedPagedList<T>` with a total count of zero.

    parameters: PaginationParameters
    The pagination parameters specifying the page size and number.

    Returns: An empty paginated list with zero elements and zero total count.

  • methodGetEnumerator
    public IEnumerator<T> GetEnumerator()

    Inherits documentation from base type or interface.

  • methodMap<TResult>
    public PagedList<TResult> Map<TResult>(Func<T, TResult> selector)

    Projects each element of the paginated list into a new form using the specified transform function.

    selector: Func<T, TResult>
    A transform function to apply to each element.

    Returns: A new `PagedList<TResult>` containing the projected elements.

    Type parameters: TResult: The type of elements contained in the projected page. Exceptions: ArgumentNullException: `selector` is `null`

  • methodWithCount
    public static CountedPagedList<T> WithCount(IReadOnlyList<T> items, PaginationParameters parameters, long totalCount)

    Creates a new `CountedPagedList<T>` with the specified items, pagination parameters, and known total count.

    items: IReadOnlyList<T>
    The materialized page of items.
    parameters: PaginationParameters
    The pagination parameters used to request the page.
    totalCount: long
    The total number of items across all pages.

    Returns: A new `CountedPagedList<T>` containing the specified elements and total count metadata.

    Exceptions: ArgumentNullException: `items` is `null`

  • methodWithoutCount
    public static PagedList<T> WithoutCount(IReadOnlyList<T> items, PaginationParameters parameters, bool hasNextPage, bool? hasPreviousPage = null)

    Creates a new `PagedList<T>` without an exact total count using forward-probe indicator metadata.

    items: IReadOnlyList<T>
    The materialized page of items.
    parameters: PaginationParameters
    The pagination parameters used to request the page.
    hasNextPage: bool
    `true` if a subsequent page exists; otherwise, `false`.
    hasPreviousPage: bool?
    `true` if a preceding page exists; otherwise, `false`.

    Returns: A new `PagedList<T>` containing the specified elements and pagination metadata.

    Exceptions: ArgumentNullException: `items` is `null`

  • propertyCount
    public int Count { get; }

    Inherits documentation from base type or interface.

  • propertyHasNextPage
    public bool HasNextPage { get; }

    Gets a value indicating whether there is a page after the current one.

  • propertyHasPreviousPage
    public bool HasPreviousPage { get; }

    Gets a value indicating whether there is a page before the current one.

  • propertyPage
    public int Page { get; }

    Gets the current page number (1-indexed).

  • propertyPageSize
    public int PageSize { get; }

    Gets the number of items per page.

  • propertyTotalCount
    public long? TotalCount { get; }

    Gets the total number of items across all pages, or `null` if not computed.

  • propertyTotalPages
    public long? TotalPages { get; }

    Gets the total number of pages, or `null` if the total count is not computed.

  • propertythis[int index]
    public T this[int index] { get; }

    Inherits documentation from base type or interface.

    index: int
class

PaginationCoreOptions

Assembly: EricksonLopez.Pagination
public class PaginationCoreOptions : IValidatableObject, IPaginationOptions
Implements: IPaginationOptions, IValidatableObject

Represents core options for configuring pagination limits and behavior.

Members (12)

  • methodValidate
    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)

    Inherits documentation from base type or interface.

    validationContext: ValidationContext
  • propertyAcceptLegacyCursors
    public bool AcceptLegacyCursors { get; set; }

    Gets or sets a value indicating whether legacy cursor formats are accepted.

  • propertyCursor
    public PaginationCursorOptions Cursor { get; set; }

    Gets or sets the options specific to keyset and cursor-based pagination.

  • propertyCursorDecoderRegistry
    public ICursorDecoderRegistry? CursorDecoderRegistry { get; set; }

    Gets or sets the registry for AOT-compatible cursor decoders.

  • propertyDeepOffsetWarningThreshold
    public int DeepOffsetWarningThreshold { get; set; }

    Gets or sets the row offset threshold above which a warning log is generated.

  • propertyDefaultPageSize
    public int DefaultPageSize { get; set; }

    Gets or sets the default page size applied when none is specified.

  • propertyMaxFilterComplexity
    public int MaxFilterComplexity { get; set; }

    Gets or sets the maximum allowed clause complexity for filter expressions.

  • propertyMaxFilterStringLength
    public int MaxFilterStringLength { get; set; }

    Gets or sets the maximum allowed length of a filter DSL string.

  • propertyMaxFilterValueLength
    public int MaxFilterValueLength { get; set; }

    Gets or sets the maximum allowed length of an individual filter value.

  • propertyMaxPageSize
    public int MaxPageSize { get; set; }

    Gets or sets the maximum allowed page size.

  • propertyMaxPropertyDepth
    public int MaxPropertyDepth { get; set; }

    Gets or sets the maximum allowed depth of nested property navigation in filter expressions.

  • propertyMaxSortStringLength
    public int MaxSortStringLength { get; set; }

    Gets or sets the maximum allowed length of a sort DSL string.

class

PaginationCoreOptionsValidator

Assembly: EricksonLopez.Pagination
public partial class PaginationCoreOptionsValidator : IValidateOptions<PaginationCoreOptions>
Implements: IValidateOptions<PaginationCoreOptions>

Provides validation for `PaginationCoreOptions` instances.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

class

PaginationCursorOptions

Assembly: EricksonLopez.Pagination
public class PaginationCursorOptions

Represents configuration options for keyset and cursor-based pagination.

Members (2)

  • propertyEncoder
    public ICursorEncoder? Encoder { get; set; }

    Gets or sets the encoder used to serialize and deserialize pagination cursors. When `null` (the default), `AddPagination()` substitutes `HmacCursorEncoder.DevelopmentDefault` and logs a startup warning reminding you to configure a production secret key before deploying.

  • propertyTenantContextProvider
    public System.Func<string?>? TenantContextProvider { get; set; }

    Gets or sets an optional delegate used to resolve the current tenant identifier. When configured, HMAC cursors are cryptographically bound to the current tenant, preventing cross-tenant cursor replay attacks.

class

PaginationDiagnostics

Assembly: EricksonLopez.Pagination
public static class PaginationDiagnostics

Provides global diagnostic infrastructure including logging and metric instruments.

Members (4)

  • methodCreateLogger<T>
    public static ILogger<T>? CreateLogger<T>()

    Creates a typed logger for the specified category type using the configured logger factory.

    Returns: A new `ILogger<TCategoryName>` instance, or `null` if no logger factory is configured.

    Type parameters: T: The type defining the logger category.

  • propertyLegacyCursorCounter
    public static Counter<long> LegacyCursorCounter { get; }

    Gets a counter metric tracking the number of legacy cursor formats accepted.

  • propertyLoggerFactory
    public static ILoggerFactory? LoggerFactory { get; set; }

    Gets or sets the application-wide logger factory for pagination logging.

  • propertyMeterFactory
    public static IMeterFactory? MeterFactory { get; set; }

    Gets or sets the application-wide meter factory for pagination metrics.

class

PaginationLogEvents

Assembly: EricksonLopez.Pagination
public static partial class PaginationLogEvents

Provides structured logging event identifiers and helper methods for cursor pagination events.

Members (6)

  • methodLogCursorExpired
    public static void LogCursorExpired(ILogger? logger, string? cursor, System.DateTimeOffset expiredAt)

    Logs a warning when a pagination cursor has expired.

    logger: ILogger?
    The logger instance to write to.
    cursor: string?
    The expired opaque cursor string.
    expiredAt: System.DateTimeOffset
    The timestamp at which the cursor expired.
  • methodLogCursorReplayed
    public static void LogCursorReplayed(ILogger? logger, string? cursor, string? nonce)

    Logs a warning when cursor replay is detected.

    logger: ILogger?
    The logger instance to write to.
    cursor: string?
    The replayed opaque cursor string.
    nonce: string?
    The nonce embedded in the cursor that was already consumed.
  • methodLogCursorTampered
    public static void LogCursorTampered(ILogger? logger, string? cursor)

    Logs a warning when cursor tampering or an invalid signature is detected.

    logger: ILogger?
    The logger instance to write to.
    cursor: string?
    The tampered opaque cursor string.
  • fieldCursorExpired
    public static readonly EventId CursorExpired

    Represents an event indicating that a time-limited cursor has expired.

  • fieldCursorReplayed
    public static readonly EventId CursorReplayed

    Represents an event indicating that a cursor replay was detected.

  • fieldCursorTampered
    public static readonly EventId CursorTampered

    Represents an event indicating that a cursor failed signature validation or was tampered with.

class

PaginationMetrics

Assembly: EricksonLopez.Pagination
public static class PaginationMetrics

Provides OpenTelemetry-compatible metrics instruments for pagination operations.

Members (9)

  • methodRecordCursorError
    public static void RecordCursorError(string errorType)

    Records a cursor validation error metric.

    errorType: string
    The error category indicating the failure reason.
  • methodRecordKeysetQuery
    public static void RecordKeysetQuery(int pageSize)

    Records a keyset pagination query execution metric.

    pageSize: int
    The requested page size.
  • methodRecordOffsetQuery
    public static void RecordOffsetQuery(int page, int pageSize)

    Records an offset pagination query execution metric.

    page: int
    The requested page number.
    pageSize: int
    The requested page size.
  • fieldCursorErrors
    public static readonly Counter<long> CursorErrors

    Represents the counter tracking total cursor validation errors.

  • fieldMeter
    public static readonly Meter Meter

    Represents the library meter instance for metrics instrumentation.

    The meter version is intentionally pinned to the API contract version ("1.2.0"), not the NuGet package release version. This keeps OpenTelemetry listener subscriptions stable across patch and minor releases that do not break the metrics schema. Update this string only when the metrics schema (instrument names or units) changes in a breaking way.

  • fieldMeterName
    public const string MeterName

    Represents the name of the Meter for OpenTelemetry listener subscriptions.

  • fieldPageDepth
    public static readonly Histogram<int> PageDepth

    Represents the histogram tracking the distribution of requested offset page depths.

  • fieldPageSize
    public static readonly Histogram<int> PageSize

    Represents the histogram tracking the distribution of requested page sizes.

  • fieldQueriesTotal
    public static readonly Counter<long> QueriesTotal

    Represents the counter tracking total pagination queries executed.

EricksonLopez.Pagination.Abstractions#

28
record

CursorPaginationParameters

Assembly: EricksonLopez.Pagination.Abstractions
public readonly record struct CursorPaginationParameters : IParsable<CursorPaginationParameters>
Implements: IParsable<CursorPaginationParameters>

Represents parameters for requesting a cursor-based paginated result set. Supports both forward (`First`/`After`) and backward (`Last`/`Before`) pagination, following the GraphQL Relay Cursor Connections Specification.

Members (8)

  • methodGetPageSize
    public int GetPageSize(int defaultSize = 10)

    Calculates the effective page size resolved from `First` or `Last`, falling back to the specified default size.

    defaultSize: int
    The fallback page size when neither `First` nor `Last` is set. Must be at least 1.

    Returns: The resolved page size.

    Pass the application-configured default rather than a hardcoded value to preserve configuration-driven policy.

  • methodParse
    public static CursorPaginationParameters Parse(string s, IFormatProvider? provider)

    Converts the string representation of cursor pagination parameters to a `CursorPaginationParameters` instance.

    s: string
    The string representation of the cursor pagination parameters to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.

    Returns: The parsed `CursorPaginationParameters` instance.

    Exceptions: ArgumentNullException: `s` is `null`; FormatException: `s` is not in a valid format

  • methodTryParse
    public static bool TryParse(string? s, IFormatProvider? provider, out CursorPaginationParameters result)

    Attempts to convert the string representation of cursor pagination parameters to a `CursorPaginationParameters` instance.

    s: string?
    The string representation of the cursor pagination parameters to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.
    result: out CursorPaginationParameters
    When this method returns, contains the parsed `CursorPaginationParameters` instance if the conversion succeeded, or the default value if it failed.

    Returns: `true` if `s` was converted successfully; otherwise, `false`.

    This implementation does not accept null or whitespace strings.

  • propertyAfter
    public string? After { get; init; }

    Gets the opaque cursor after which to take items in forward pagination.

    When specified, only items positioned after the element identified by this cursor are returned.

  • propertyBefore
    public string? Before { get; init; }

    Gets the opaque cursor before which to take items in backward pagination.

    When specified, only items positioned before the element identified by this cursor are returned.

  • propertyFirst
    public int? First { get; init; }

    Gets the number of items to take from the beginning of the result set in forward pagination.

    Mutually exclusive with `Last`. If both are specified, `First` takes precedence. Exceptions: ArgumentOutOfRangeException: `value` is less than 1 or greater than 100,000

  • propertyLast
    public int? Last { get; init; }

    Gets the number of items to take from the end of the result set in backward pagination.

    Mutually exclusive with `First`. Used in conjunction with `Before` for backward traversal. Exceptions: ArgumentOutOfRangeException: `value` is less than 1 or greater than 100,000

  • fieldDefault
    public static readonly CursorPaginationParameters Default

    Represents the default cursor pagination parameters configured for forward pagination with 10 items.

class

ExpiredPaginationCursorException

Assembly: EricksonLopez.Pagination.Abstractions
public sealed class ExpiredPaginationCursorException : InvalidPaginationCursorException
Inherits: InvalidPaginationCursorException

Represents the error raised when a time-limited cursor has passed its expiration time.

Remarks:

This exception is a subclass of `InvalidPaginationCursorException` so callers can catch it specifically or via the parent type, depending on whether they need to distinguish expiration from tampering.

Members (2)

  • constructorExpiredPaginationCursorException
    public ExpiredPaginationCursorException(string? opaqueCursor, DateTimeOffset expiredAt)

    Initializes a new instance of the `ExpiredPaginationCursorException` class with the expired cursor value and expiration timestamp.

    opaqueCursor: string?
    The raw cursor value that failed to decode.
    expiredAt: DateTimeOffset
    The UTC timestamp at which the cursor expired.
  • propertyExpiredAt
    public DateTimeOffset ExpiredAt { get; }

    Gets the Coordinated Universal Time (UTC) timestamp at which the cursor expired.

class

FilterExpressionExtensions

Assembly: EricksonLopez.Pagination.Abstractions
public static class FilterExpressionExtensions

Provides extension methods for combining and manipulating strongly typed filter expressions.

Members (3)

  • methodAnd<T>
    public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)

    Combines two predicate expressions using a logical conditional AND operator.

    first: this Expression<Func<T, bool>>
    The first predicate expression.
    second: Expression<Func<T, bool>>
    The second predicate expression to combine.

    Returns: A new lambda expression representing the logical conjunction of both predicates.

    Type parameters: T: The type of the entity. Exceptions: ArgumentNullException: `first` or `second` is `null`

  • methodNot<T>
    public static Expression<Func<T, bool>> Not<T>(this Expression<Func<T, bool>> expression)

    Negates a predicate expression using a logical NOT operator.

    expression: this Expression<Func<T, bool>>
    The predicate expression to negate.

    Returns: A new lambda expression representing the logical negation of the specified predicate.

    Type parameters: T: The type of the entity. Exceptions: ArgumentNullException: `expression` is `null`

  • methodOr<T>
    public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> first, Expression<Func<T, bool>> second)

    Combines two predicate expressions using a logical conditional OR operator.

    first: this Expression<Func<T, bool>>
    The first predicate expression.
    second: Expression<Func<T, bool>>
    The second predicate expression to combine.

    Returns: A new lambda expression representing the logical disjunction of both predicates.

    Type parameters: T: The type of the entity. Exceptions: ArgumentNullException: `first` or `second` is `null`

delegate

FilterOperatorHandler<TEntity>

Assembly: EricksonLopez.Pagination.Abstractions
public delegate Expression? FilterOperatorHandler<TEntity>(Expression propertyExpression, string rawValue)
Inherits: System.MulticastDelegate

Represents a custom filter operator delegate that constructs an expression predicate given a target property expression and a raw filter value.

Remarks:

Type parameters: TEntity: The type of the entity being filtered.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

record

FilterParameters

Assembly: EricksonLopez.Pagination.Abstractions
public readonly record struct FilterParameters : IParsable<FilterParameters>
Implements: IParsable<FilterParameters>

Represents a structured filter expression for paginated queries, following the same convention as `PaginationParameters` and `CursorPaginationParameters`.

Remarks:

The filter string uses a simple, URL-friendly DSL: `field=value` for equality, `field!=value` for inequality, `field>value`, `field<value`, `field>=value`, `field<=value` for comparisons, `field~=value` for string contains, `field^=value` for starts-with, `field$=value` for ends-with. Multiple filters are separated by commas. Example: `name~=John,age>=18,isActive=true` Zero-dependency contract: This type lives in the Abstractions package and has no EF Core dependency. The expression translation is performed by `QueryableExtensions.ApplyFilter` in the `EricksonLopez.Pagination.EntityFrameworkCore` package. String Case-Sensitivity: String matching operators (`~=`, `^=`, `$=`) are translated directly to standard framework methods (like `string.Contains`) without explicit `StringComparison`. When executed against a database (e.g., via EF Core or Dapper), the case-sensitivity of the search is entirely determined by the database column's collation (e.g., case-insensitive in SQL Server's default collation, but case-sensitive in PostgreSQL's `C` collation). When executed in-memory against `IEnumerable<T>`, the search is natively case-sensitive. Design decision: Implements `IParsable<T>` (on .NET 7+) to support automatic binding in ASP.NET Core Minimal APIs via `[AsParameters]` or from query strings. The `TryParse` implementation applies basic syntax validation to ensure it doesn't fail silently.

Members (9)

  • methodFrom
    public static FilterParameters From(string? filter)

    Creates a new `FilterParameters` instance initialized with the specified raw filter string.

    filter: string?
    The filter expression string.

    Returns: A new `FilterParameters` instance.

  • methodParse
    public static FilterParameters Parse(string s, IFormatProvider? provider)

    Converts the string representation of filter parameters to a `FilterParameters` instance.

    s: string
    The filter DSL string to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.

    Returns: A `FilterParameters` instance representing the parsed filter.

    Exceptions: ArgumentNullException: `s` is `null`; FormatException: `s` is not a valid filter expression

  • methodToString
    public override string ToString()

    Inherits documentation from base type or interface.

  • methodTryParse
    public static bool TryParse(string? s, IFormatProvider? provider, out FilterParameters result)

    Attempts to convert the string representation of filter parameters to a `FilterParameters` instance.

    s: string?
    The filter DSL string to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.
    result: out FilterParameters
    When this method returns, contains the parsed `FilterParameters` if the conversion succeeded; otherwise, the default value.

    Returns: `true` if `s` was successfully parsed; otherwise, `false`.

    Two-layer validation design: This method performs syntax-only validation and total string length checks (up to `AbsoluteMaxLength` = 4096 characters). Individual filter value length validation (e.g., limiting LIKE patterns to prevent DoS attacks) is performed at expression build time by `QueryableExtensions.ApplyFilter` using the runtime-configured `PaginationCoreOptions.MaxFilterValueLength`. This separation keeps the Abstractions package free of runtime dependencies. When this method returns `false`, `result` contains `default` (`Empty`). Both are equivalent because `FilterParameters.default` and `FilterParameters.Empty` have identical runtime behaviour (`HasValue` returns `false` in both cases).

  • propertyHasValue
    public bool HasValue { get; }

    Gets a value indicating whether this instance contains a non-empty filter expression.

  • propertyValue
    public string? Value { get; init; }

    Gets the raw filter expression string.

  • fieldAbsoluteMaxComplexity
    public const int AbsoluteMaxComplexity

    Represents the maximum number of filter clauses permitted in an expression.

  • fieldAbsoluteMaxLength
    public const int AbsoluteMaxLength

    Represents the maximum character length permitted for a filter expression string.

  • fieldEmpty
    public static readonly FilterParameters Empty

    Represents an empty filter parameter instance with no filter applied.

class

FilterableAttribute

Assembly: EricksonLopez.Pagination.Abstractions
public sealed class FilterableAttribute : Attribute
Inherits: Attribute

Specifies that a property is explicitly permitted for dynamic filtering operations.

Remarks:

When applied to one or more properties in a type, only properties decorated with this attribute can be used in dynamic filter expressions.

Members (3)

  • constructorFilterableAttribute
    public FilterableAttribute()

    Initializes a new instance of the `FilterableAttribute` class.

  • constructorFilterableAttribute
    public FilterableAttribute(string? name)

    Initializes a new instance of the `FilterableAttribute` class with a custom alias name.

    name: string?
    The custom alias name used to reference this property in filter expressions.
  • propertyName
    public string? Name { get; set; }

    Gets or sets the custom alias name for the property when referenced in dynamic filter expressions.

class

GenerateFilterProviderAttribute

Assembly: EricksonLopez.Pagination.Abstractions
public sealed class GenerateFilterProviderAttribute : Attribute
Inherits: Attribute

Specifies that a source generator should generate a strongly typed, reflection-free `IFilterProvider<TEntity>` for the decorated type.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

ICountedCursorPagedList

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICountedCursorPagedList : ICursorPagedList
Implements: ICursorPagedList

Defines cursor-based pagination metadata with an explicit total count of elements.

Members (2)

  • propertyExactTotalCount
    long ExactTotalCount { get; }

    Gets the exact total number of items across all pages.

  • propertyTotalCount
    long? TotalCount { get; }

    Gets the total number of items across all pages, or `null` if not computed.

interface

ICountedCursorPagedList<T>

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICountedCursorPagedList<T> : ICursorPagedList<T>, ICountedCursorPagedList
Implements: ICountedCursorPagedList, ICursorPagedList<T>

Defines a cursor-paginated list with an explicit total count of elements.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

ICountedPagedList

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICountedPagedList : IPagedList
Implements: IPagedList

Defines offset-based pagination metadata with total count information.

Members (2)

  • propertyExactTotalCount
    long ExactTotalCount { get; }

    Gets the exact total number of items across all pages.

  • propertyTotalCount
    new long TotalCount { get; }

    Gets the exact total number of items across all pages.

interface

ICountedPagedList<T>

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICountedPagedList<T> : IPagedList<T>, ICountedPagedList
Implements: ICountedPagedList, IPagedList<T>

Defines a generic paginated list with total count metadata.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

ICursorDecoderRegistry

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICursorDecoderRegistry

Defines a registry for storing per-type cursor decoder delegates to enable trimming- and AOT-safe cursor decoding.

Members (4)

  • methodClear
    void Clear()

    Removes all registered decoders from the registry.

  • methodRegister<TKey>
    void Register<TKey>(Func<string, TKey> decoder)

    Registers a cursor decoder delegate for the specified key type.

    decoder: Func<string, TKey>
    The function that converts an opaque cursor string to a `TKey` value.

    Type parameters: TKey: The cursor key type handled by this decoder.

  • methodTryGetDecoder<TKey>
    bool TryGetDecoder<TKey>(out Func<string, TKey>? decoder)

    Attempts to retrieve a registered cursor decoder for the specified key type.

    decoder: out Func<string, TKey>?
    When this method returns, contains the registered decoder function if found; otherwise, `null`.

    Returns: `true` if a decoder for `TKey` is registered; otherwise, `false`.

    Type parameters: TKey: The cursor key type to decode.

  • methodUnregister<TKey>
    bool Unregister<TKey>()

    Removes the registered cursor decoder for the specified key type.

    Returns: `true` if the decoder was found and removed; otherwise, `false`.

    Type parameters: TKey: The cursor key type whose decoder should be removed.

interface

ICursorPagedList

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICursorPagedList

Defines cursor-based pagination metadata for a paginated result set.

Members (4)

  • propertyEndCursor
    string? EndCursor { get; }

    Gets the opaque cursor to the last item in the current page.

  • propertyHasNextPage
    bool HasNextPage { get; }

    Gets a value indicating whether there is a page after the current one.

  • propertyHasPreviousPage
    bool HasPreviousPage { get; }

    Gets a value indicating whether there is a page before the current one.

  • propertyStartCursor
    string? StartCursor { get; }

    Gets the opaque cursor to the first item in the current page.

interface

ICursorPagedListFactory

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICursorPagedListFactory

Defines a factory for creating cursor-based paginated list instances.

Members (1)

  • methodCreateCursorPagedList<T>
    ICursorPagedList<T> CreateCursorPagedList<T>(IReadOnlyList<T> items, long? totalCount, string? startCursor, string? endCursor, bool hasPreviousPage, bool hasNextPage)

    Creates a new cursor-based paginated list containing the specified items and pagination metadata.

    items: IReadOnlyList<T>
    The items on the current page.
    totalCount: long?
    The optional total number of items across all pages.
    startCursor: string?
    The opaque cursor of the first item in the page.
    endCursor: string?
    The opaque cursor of the last item in the page.
    hasPreviousPage: bool
    A value indicating whether a preceding page exists.
    hasNextPage: bool
    A value indicating whether a subsequent page exists.

    Returns: A new `ICursorPagedList<T>` instance containing the specified elements and metadata.

    Type parameters: T: The type of elements in the page.

interface

ICursorPagedList<T>

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICursorPagedList<T> : IReadOnlyList<T>, ICursorPagedList
Implements: ICursorPagedList, IReadOnlyList<T>

Defines a generic cursor-paginated list returned by keyset pagination queries.

Remarks:

Covariance (`out T`) allows assigning an instance to a variable typed with a less-derived element type for reference types. Type parameters: T: The type of elements contained in the page.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

ICursorReplayStore

Assembly: EricksonLopez.Pagination.Abstractions
public interface ICursorReplayStore

Defines a store for recording and validating single-use cursor nonces to protect against replay attacks.

Members (2)

  • methodTryAcquireNonce
    bool TryAcquireNonce(string nonce, TimeSpan timeToLive)

    Attempts to acquire and record a cursor nonce.

    nonce: string
    The unique nonce string embedded within the cursor.
    timeToLive: TimeSpan
    The duration for which the nonce must be retained in the store.

    Returns: `true` if the nonce was fresh and successfully recorded; otherwise, `false` if it was previously consumed.

  • methodTryAcquireNonceAsync
    Task<bool> TryAcquireNonceAsync(string nonce, TimeSpan timeToLive, CancellationToken cancellationToken = default)

    Attempts to acquire and record a cursor nonce asynchronously.

    nonce: string
    The unique nonce string embedded within the cursor.
    timeToLive: TimeSpan
    The duration for which the nonce must be retained in the store.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains `true` if the nonce was fresh and successfully recorded; otherwise, `false` if it was previously consumed.

interface

IFilterOperatorProvider<TEntity>

Assembly: EricksonLopez.Pagination.Abstractions
public interface IFilterOperatorProvider<TEntity>

Defines a contract for providing custom filter operators to extend dynamic filter DSL evaluation.

Remarks:

Type parameters: TEntity: The entity type.

Members (1)

  • propertyOperators
    IReadOnlyDictionary<string, FilterOperatorHandler<TEntity>> Operators { get; }

    Gets the dictionary of custom operators registered for the entity type, keyed by operator symbol (e.g. "%=", "in", "geo_near").

interface

IFilterProvider<TEntity>

Assembly: EricksonLopez.Pagination.Abstractions
public interface IFilterProvider<TEntity>

Defines an AOT-safe contract for building strongly typed filter expressions from filter parameters without relying on runtime reflection.

Remarks:

Type parameters: TEntity: The type of the entity to filter.

Members (1)

  • methodBuild
    Expression<Func<TEntity, bool>>? Build(FilterParameters filter)

    Builds a predicate expression for filtering entities based on the specified filter parameters.

    filter: FilterParameters
    The filter parameters containing field constraints and comparison expressions.

    Returns: A lambda expression predicate representing the filtering logic, or `null` if no filter is specified.

interface

IPagedList

Assembly: EricksonLopez.Pagination.Abstractions
public interface IPagedList

Defines offset-based metadata for a paginated list.

Members (6)

  • propertyHasNextPage
    bool HasNextPage { get; }

    Gets a value indicating whether there is a page after the current one.

  • propertyHasPreviousPage
    bool HasPreviousPage { get; }

    Gets a value indicating whether there is a page before the current one.

  • propertyPage
    int Page { get; }

    Gets the current page number (1-indexed).

  • propertyPageSize
    int PageSize { get; }

    Gets the number of items per page.

  • propertyTotalCount
    long? TotalCount { get; }

    Gets the total number of items across all pages, or `null` if not computed.

  • propertyTotalPages
    long? TotalPages { get; }

    Gets the total number of pages, or `null` if the total count is not computed.

interface

IPagedListFactory

Assembly: EricksonLopez.Pagination.Abstractions
public interface IPagedListFactory

Defines a factory for creating offset-based paginated list instances.

Members (1)

  • methodCreatePagedList<T>
    IPagedList<T> CreatePagedList<T>(IReadOnlyList<T> items, long? totalCount, int page, int pageSize, bool? hasNextPage)

    Creates a new offset-based paginated list containing the specified items and pagination metadata.

    items: IReadOnlyList<T>
    The collection of items on the current page.
    totalCount: long?
    The total number of items across all pages, or `null` if uncounted.
    page: int
    The current 1-indexed page number.
    pageSize: int
    The number of items per page.
    hasNextPage: bool?
    A value indicating whether a subsequent page exists, or `null` if derived from total count.

    Returns: A new `IPagedList<T>` instance containing the specified elements and metadata.

    Type parameters: T: The type of elements in the page.

interface

IPagedList<T>

Assembly: EricksonLopez.Pagination.Abstractions
public interface IPagedList<T> : IReadOnlyList<T>, IPagedList
Implements: IPagedList, IReadOnlyList<T>

Defines a generic paginated list with offset-based metadata.

Remarks:

Covariance (`out T`) allows assigning an instance to a variable typed with a less-derived element type for reference types. Type parameters: T: The type of elements contained in the page.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

interface

IPaginationOptions

Assembly: EricksonLopez.Pagination.Abstractions
public interface IPaginationOptions

Defines core options for configuring pagination limits and behavior.

Members (9)

  • propertyCursorDecoderRegistry
    ICursorDecoderRegistry? CursorDecoderRegistry { get; }

    Gets the registry for AOT-compatible cursor decoders.

  • propertyDeepOffsetWarningThreshold
    int DeepOffsetWarningThreshold { get; }

    Gets the row offset threshold above which a deep-offset log warning is emitted.

  • propertyDefaultPageSize
    int DefaultPageSize { get; }

    Gets the default page size applied when no page size is specified.

  • propertyMaxFilterComplexity
    int MaxFilterComplexity { get; }

    Gets the maximum number of individual filter clauses permitted in a filter expression.

  • propertyMaxFilterStringLength
    int MaxFilterStringLength { get; }

    Gets the maximum character length permitted for a filter expression string.

  • propertyMaxFilterValueLength
    int MaxFilterValueLength { get; }

    Gets the maximum character length permitted for an individual filter value operand.

  • propertyMaxPageSize
    int MaxPageSize { get; }

    Gets the maximum allowed page size.

  • propertyMaxPropertyDepth
    int MaxPropertyDepth { get; }

    Gets the maximum allowed depth of nested property navigation in a filter expression.

  • propertyMaxSortStringLength
    int MaxSortStringLength { get; }

    Gets the maximum character length permitted for a sort expression string.

class

InvalidPaginationCursorException

Assembly: EricksonLopez.Pagination.Abstractions
public class InvalidPaginationCursorException : Exception
Inherits: Exception

Represents the exception thrown when a pagination cursor cannot be decoded because it is malformed, invalid, or tampered with.

Members (4)

  • constructorInvalidPaginationCursorException
    public InvalidPaginationCursorException(string message)

    Initializes a new instance of the `InvalidPaginationCursorException` class with a specified error message.

    message: string
    The message that describes the error.
  • constructorInvalidPaginationCursorException
    public InvalidPaginationCursorException(string message, string? opaqueCursor)

    Initializes a new instance of the `InvalidPaginationCursorException` class with a specified error message and the invalid cursor value.

    message: string
    The message that describes the error.
    opaqueCursor: string?
    The raw cursor value that failed decoding.
  • constructorInvalidPaginationCursorException
    public InvalidPaginationCursorException(string message, string? opaqueCursor, Exception innerException)

    Initializes a new instance of the `InvalidPaginationCursorException` class with a specified error message, the invalid cursor value, and a reference to the inner exception that is the cause of this exception.

    message: string
    The message that describes the error.
    opaqueCursor: string?
    The raw cursor value that failed decoding.
    innerException: Exception
    The exception that is the cause of the current exception.
  • propertyOpaqueCursor
    public string? OpaqueCursor { get; }

    Gets the raw cursor string that failed decoding.

record

PaginationParameters

Assembly: EricksonLopez.Pagination.Abstractions
public readonly record struct PaginationParameters : IParsable<PaginationParameters>
Implements: IParsable<PaginationParameters>

Represents parameters for requesting a paginated result set using offset pagination.

Remarks:

Page numbers are 1-indexed. Validation contract: The `init` accessor of `Page` and `PageSize` throw `ArgumentOutOfRangeException` for values below 1. The parameterless default constructor produces a zero-initialized struct whose getters clamp to the defaults (page = 1, pageSize = 10); this is intentional to allow zero-initialization for framework infrastructure (e.g., model binding before validation runs). Consumer code should always use `Create` or the object-initializer syntax. Minimal API binding: On .NET 7 and later, this struct implements `IParsable{T}` which enables native query-string binding in ASP.NET Core Minimal APIs via `[AsParameters]`. The parse format is `page={n}&pageSize={m}`. Invalid values produce `FormatException`.

Members (6)

  • methodCreate
    public static PaginationParameters Create(int page, int pageSize)

    Creates a new `PaginationParameters` instance with the specified page number and page size.

    page: int
    The page number (1-indexed). Must be at least 1.
    pageSize: int
    The number of items per page. Must be between 1 and 100,000.

    Returns: A new `PaginationParameters` instance.

    Exceptions: ArgumentOutOfRangeException: `page` or `pageSize` is less than 1, or `pageSize` is greater than 100,000

  • methodParse
    public static PaginationParameters Parse(string s, IFormatProvider? provider)

    Converts the string representation of pagination parameters to a `PaginationParameters` instance.

    s: string
    The string representation of the pagination parameters to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.

    Returns: The parsed `PaginationParameters` instance.

    Exceptions: ArgumentNullException: `s` is `null`; FormatException: `s` is not in a valid format

  • methodTryParse
    public static bool TryParse(string? s, IFormatProvider? provider, out PaginationParameters result)

    Attempts to convert the string representation of pagination parameters to a `PaginationParameters` instance.

    s: string?
    The string representation of the pagination parameters to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.
    result: out PaginationParameters
    When this method returns, contains the parsed `PaginationParameters` instance if the conversion succeeded, or the default value if it failed.

    Returns: `true` if `s` was converted successfully or was null or whitespace; otherwise, `false`.

  • propertyPage
    public int Page { get; init; }

    Gets the current page number (1-indexed).

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1

  • propertyPageSize
    public int PageSize { get; init; }

    Gets the number of items per page.

    Exceptions: ArgumentOutOfRangeException: `value` is less than 1 or greater than 100,000

  • fieldDefault
    public static readonly PaginationParameters Default

    Represents the default pagination parameters configured for page 1 with 10 items per page.

struct

RawCursorValue

Assembly: EricksonLopez.Pagination.Abstractions
public readonly struct RawCursorValue : System.IEquatable<RawCursorValue>
Implements: System.IEquatable<RawCursorValue>

Represents an unencoded cursor value for forward or backward pagination.

Members (7)

  • constructorRawCursorValue
    public RawCursorValue(string value)

    Initializes a new instance of the `RawCursorValue` struct with the specified raw cursor string.

    value: string
    The raw cursor value string.
  • methodEquals
    public bool Equals(RawCursorValue other)

    Inherits documentation from base type or interface.

    other: RawCursorValue
  • methodEquals
    public override bool Equals(object? obj)

    Inherits documentation from base type or interface.

    obj: object?
  • methodGetHashCode
    public override int GetHashCode()

    Inherits documentation from base type or interface.

  • methodoperator !=
    public static bool operator !=(RawCursorValue left, RawCursorValue right)

    Determines whether two `RawCursorValue` instances are not equal.

    left: RawCursorValue
    The first instance to compare.
    right: RawCursorValue
    The second instance to compare.

    Returns: `true` if the instances are not equal; otherwise, `false`.

  • methodoperator ==
    public static bool operator ==(RawCursorValue left, RawCursorValue right)

    Determines whether two `RawCursorValue` instances are equal.

    left: RawCursorValue
    The first instance to compare.
    right: RawCursorValue
    The second instance to compare.

    Returns: `true` if both instances are equal; otherwise, `false`.

  • propertyValue
    public string Value { get; }

    Gets the raw cursor value string.

class

ReplayedPaginationCursorException

Assembly: EricksonLopez.Pagination.Abstractions
public class ReplayedPaginationCursorException : InvalidPaginationCursorException
Inherits: InvalidPaginationCursorException

Represents the exception thrown when a pagination cursor that has already been consumed is replayed in a replay-protected context.

Members (3)

  • constructorReplayedPaginationCursorException
    public ReplayedPaginationCursorException(string message, Exception innerException, string? cursor = null, string? nonce = null)

    Initializes a new instance of the `ReplayedPaginationCursorException` class with a specified error message, a reference to the inner exception that is the cause of this exception, the replayed cursor value, and the nonce.

    message: string
    The error message that explains the reason for the exception.
    innerException: Exception
    The exception that is the cause of the current exception.
    cursor: string?
    The opaque cursor that was replayed.
    nonce: string?
    The embedded nonce string.
  • constructorReplayedPaginationCursorException
    public ReplayedPaginationCursorException(string message, string? cursor = null, string? nonce = null)

    Initializes a new instance of the `ReplayedPaginationCursorException` class with a specified error message, the replayed cursor value, and the nonce.

    message: string
    The error message that explains the reason for the exception.
    cursor: string?
    The opaque cursor that was replayed.
    nonce: string?
    The embedded nonce string.
  • propertyNonce
    public string? Nonce { get; }

    Gets the unique nonce associated with the replayed cursor.

enum

SortDirection

Assembly: EricksonLopez.Pagination.Abstractions
public enum SortDirection

Specifies the direction in which results are sorted.

Members (2)

  • fieldAscending
    Ascending

    Sorts results in ascending order, from smallest to largest.

  • fieldDescending
    Descending

    Sorts results in descending order, from largest to smallest.

record

SortParameters

Assembly: EricksonLopez.Pagination.Abstractions
public readonly partial record struct SortParameters : IParsable<SortParameters>
Implements: IParsable<SortParameters>

Represents structured sorting parameters for paginated queries, following the same convention as `FilterParameters`.

Remarks:

The sort string uses a simple DSL: comma-separated property names, optionally followed by 'asc' or 'desc'. Example: `name asc,age desc` Zero-dependency contract: This type lives in the Abstractions package and has no EF Core dependency. The expression translation is performed by `QueryableExtensions.ApplySort` in the `EricksonLopez.Pagination.EntityFrameworkCore` package.

Members (9)

  • methodFrom
    public static SortParameters From(string? sort)

    Creates a new `SortParameters` instance initialized with the specified raw sort string.

    sort: string?
    The sort expression string.

    Returns: A new `SortParameters` instance.

  • methodParse
    public static SortParameters Parse(string s, IFormatProvider? provider)

    Converts the string representation of sort parameters to a `SortParameters` instance.

    s: string
    The sort DSL string to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.

    Returns: A `SortParameters` instance representing the parsed sort expression.

    Exceptions: FormatException: `s` is not a valid sort expression

  • methodToString
    public override string ToString()

    Inherits documentation from base type or interface.

  • methodTryParse
    public static bool TryParse(string? s, IFormatProvider? provider, out SortParameters result)

    Attempts to convert the string representation of sort parameters to a `SortParameters` instance.

    s: string?
    The sort DSL string to parse.
    provider: IFormatProvider?
    An object that provides culture-specific formatting information. Ignored.
    result: out SortParameters
    When this method returns, contains the parsed `SortParameters` if the conversion succeeded; otherwise, the default empty instance.

    Returns: `true` if `s` was converted successfully; otherwise, `false`.

  • methodValidateColumnName
    public static void ValidateColumnName(string columnName, IEnumerable<string>? allowedProperties = null)

    Validates that the specified column name is a permitted sort column.

    columnName: string
    The dot-separated column name to validate.
    allowedProperties: IEnumerable<string>?
    An optional collection of permitted column names.

    Exceptions: ArgumentException: `columnName` is null, whitespace, exceeds 200 characters, or contains invalid characters; InvalidOperationException: `allowedProperties` is provided and `columnName` is not in the allowlist

  • methodValidateColumnName
    public static void ValidateColumnName(string columnName, IReadOnlySet<string> allowedProperties)

    Validates that the specified column name is present in the permitted property set.

    columnName: string
    The dot-separated column name to validate.
    allowedProperties: IReadOnlySet<string>
    A non-null set of permitted column names or root segments.

    Exceptions: ArgumentException: `columnName` is null, whitespace, exceeds 200 characters, or contains invalid characters; ArgumentNullException: `allowedProperties` is `null`; InvalidOperationException: `columnName` is not in `allowedProperties`

  • propertyHasValue
    public bool HasValue { get; }

    Gets a value indicating whether this instance contains a non-empty sort expression.

  • propertyValue
    public string? Value { get; init; }

    Gets the raw sort expression string.

  • fieldEmpty
    public static readonly SortParameters Empty

    Represents an empty sort parameter instance with no sorting applied.

EricksonLopez.Pagination.Analyzers#

6
class

CursorSecurityAnalyzer

Assembly: EricksonLopez.Pagination.Analyzers
public class CursorSecurityAnalyzer : DiagnosticAnalyzer
Inherits: DiagnosticAnalyzer

Provides a diagnostic analyzer that warns about the use of insecure default cursor encoders.

Members (3)

  • methodInitialize
    public override void Initialize(AnalysisContext context)

    Inherits documentation from base type or interface.

    context: AnalysisContext
  • propertySupportedDiagnostics
    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

    Inherits documentation from base type or interface.

  • fieldDiagnosticId
    public const string DiagnosticId

    Represents the diagnostic identifier for insecure default cursor encoder usages.

class

ExplicitBase64CursorEncoderAnalyzer

Assembly: EricksonLopez.Pagination.Analyzers
public sealed class ExplicitBase64CursorEncoderAnalyzer : DiagnosticAnalyzer
Inherits: DiagnosticAnalyzer

Provides a diagnostic analyzer that warns when `Base64CursorEncoder` is explicitly instantiated or referenced.

Members (3)

  • methodInitialize
    public override void Initialize(AnalysisContext context)

    Inherits documentation from base type or interface.

    context: AnalysisContext
  • propertySupportedDiagnostics
    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

    Inherits documentation from base type or interface.

  • fieldDiagnosticId
    public const string DiagnosticId

    Represents the diagnostic identifier for explicit Base64 cursor encoder usages.

class

KeysetColumnCountAnalyzer

Assembly: EricksonLopez.Pagination.Analyzers
public sealed class KeysetColumnCountAnalyzer : DiagnosticAnalyzer
Inherits: DiagnosticAnalyzer

Provides a diagnostic analyzer that warns when a KeysetBuilder chain contains more than 5 column registrations.

Members (4)

  • methodInitialize
    public override void Initialize(AnalysisContext context)

    Inherits documentation from base type or interface.

    context: AnalysisContext
  • propertySupportedDiagnostics
    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

    Inherits documentation from base type or interface.

  • fieldDiagnosticId
    public const string DiagnosticId

    Represents the diagnostic identifier for excessive keyset column count warnings.

  • fieldMaxRecommendedColumns
    public const int MaxRecommendedColumns

    Represents the maximum recommended number of keyset columns before a warning is emitted.

class

MissingOrderByAnalyzer

Assembly: EricksonLopez.Pagination.Analyzers
public class MissingOrderByAnalyzer : DiagnosticAnalyzer
Inherits: DiagnosticAnalyzer

Provides a diagnostic analyzer that warns when an `IQueryable<T>` is not ordered before invoking pagination methods.

Members (4)

  • methodInitialize
    public override void Initialize(AnalysisContext context)

    Inherits documentation from base type or interface.

    context: AnalysisContext
  • propertySupportedDiagnostics
    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

    Inherits documentation from base type or interface.

  • fieldCursorDiagnosticId
    public const string CursorDiagnosticId

    Represents the diagnostic identifier for unexpected pre-ordering before cursor pagination.

  • fieldDiagnosticId
    public const string DiagnosticId

    Represents the diagnostic identifier for missing ordering before offset pagination.

class

OrderByBeforeCursorAnalyzer

Assembly: EricksonLopez.Pagination.Analyzers
public sealed class OrderByBeforeCursorAnalyzer : DiagnosticAnalyzer
Inherits: DiagnosticAnalyzer

Provides a diagnostic analyzer that warns when ordering methods are invoked before cursor pagination.

Members (3)

  • methodInitialize
    public override void Initialize(AnalysisContext context)

    Inherits documentation from base type or interface.

    context: AnalysisContext
  • propertySupportedDiagnostics
    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

    Inherits documentation from base type or interface.

  • fieldDiagnosticId
    public const string DiagnosticId

    Represents the diagnostic identifier for ordering before cursor pagination.

class

SourceGeneratorRecommendationAnalyzer

Assembly: EricksonLopez.Pagination.Analyzers
public sealed class SourceGeneratorRecommendationAnalyzer : DiagnosticAnalyzer
Inherits: DiagnosticAnalyzer

Provides a diagnostic analyzer that recommends installing the source generators package for optimal performance.

Members (3)

  • methodInitialize
    public override void Initialize(AnalysisContext context)

    Inherits documentation from base type or interface.

    context: AnalysisContext
  • propertySupportedDiagnostics
    public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }

    Inherits documentation from base type or interface.

  • fieldDiagnosticId
    public const string DiagnosticId

    Represents the diagnostic identifier for source generator installation recommendations.

EricksonLopez.Pagination.AspNetCore#

19
class

CursorPagedResponse<T>

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class CursorPagedResponse<T> where T : notnull

Represents a standardized API response wrapper for cursor-paginated lists.

Remarks:

Type parameters: T: The type of the node in each edge.

Members (2)

  • propertyEdges
    public IReadOnlyList<Edge<T>> Edges { get; init; }

    Gets the list of edges, each containing an item and its associated cursor.

  • propertyPageInfo
    public RelayPageInfo PageInfo { get; init; }

    Gets the pagination metadata for the current page.

class

CursorPaginationParametersModelBinder

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class CursorPaginationParametersModelBinder : IModelBinder
Implements: IModelBinder

Provides a model binder for `CursorPaginationParameters` that extracts cursor pagination parameters from the request.

Members (2)

  • constructorCursorPaginationParametersModelBinder
    public CursorPaginationParametersModelBinder(IOptionsSnapshot<PaginationCoreOptions> options)

    Initializes a new instance of the `CursorPaginationParametersModelBinder` class with the specified options.

    options: IOptionsSnapshot<PaginationCoreOptions>
    The pagination options snapshot resolved per-request.
  • methodBindModelAsync
    public Task BindModelAsync(ModelBindingContext bindingContext)

    Inherits documentation from base type or interface.

    bindingContext: ModelBindingContext
record

Edge<T>

Assembly: EricksonLopez.Pagination.AspNetCore
public readonly record struct Edge<T> where T : notnull

Represents an individual item paired with its opaque cursor.

Remarks:

Type parameters: T: The type of the node.

Members (2)

  • propertyCursor
    public string? Cursor { get; init; }

    Gets the opaque cursor identifying the position of the item.

  • propertyNode
    public required T Node { get; init; }

    Gets the item at this position in the result set.

class

FilterParametersModelBinder

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class FilterParametersModelBinder : IModelBinder
Implements: IModelBinder

Provides a model binder for `FilterParameters` that extracts filter expressions from the request.

Members (2)

  • constructorFilterParametersModelBinder
    public FilterParametersModelBinder(IOptionsSnapshot<PaginationCoreOptions> options)

    Initializes a new instance of the `FilterParametersModelBinder` class with the specified options.

    options: IOptionsSnapshot<PaginationCoreOptions>
    The pagination options snapshot resolved per-request.
  • methodBindModelAsync
    public Task BindModelAsync(ModelBindingContext bindingContext)

    Inherits documentation from base type or interface.

    bindingContext: ModelBindingContext
class

PagedResponse<T>

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class PagedResponse<T>

Represents a standardized API response wrapper for offset-paginated lists.

Remarks:

Type parameters: T: The type of elements contained in the page.

Members (9)

  • propertyHasNextPage
    public bool HasNextPage { get; init; }

    Gets a value indicating whether a subsequent page exists.

  • propertyHasPreviousPage
    public bool HasPreviousPage { get; init; }

    Gets a value indicating whether a preceding page exists.

  • propertyItems
    public IReadOnlyList<T> Items { get; init; }

    Gets the items on the current page.

  • propertyNextPageUrl
    public string? NextPageUrl { get; init; }

    Gets the URL pointing to the next page of results, if available.

  • propertyPage
    public int Page { get; init; }

    Gets the current 1-indexed page number.

  • propertyPageSize
    public int PageSize { get; init; }

    Gets the number of items per page.

  • propertyPreviousPageUrl
    public string? PreviousPageUrl { get; init; }

    Gets the URL pointing to the previous page of results, if available.

  • propertyTotalCount
    public long? TotalCount { get; init; }

    Gets the total number of items across all pages, or `null` when not computed.

  • propertyTotalPages
    public long? TotalPages { get; init; }

    Gets the total number of pages, or `null` when not computed.

class

PaginationAspNetCoreOptions

Assembly: EricksonLopez.Pagination.AspNetCore
public class PaginationAspNetCoreOptions

Represents configuration options for integrating pagination with the ASP.NET Core pipeline.

Members (1)

  • propertyModelBinderProviderInsertIndex
    public int? ModelBinderProviderInsertIndex { get; set; }

    Gets or sets the zero-based index at which the model binder provider is inserted into the MVC provider list.

class

PaginationETagOptions

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class PaginationETagOptions

Represents configuration options for ETag generation in pagination result extensions.

Members (3)

  • propertyCustomCursorETagFactory
    public Func<object, string>? CustomCursorETagFactory { get; init; }

    Gets or sets a custom ETag factory for cursor-paginated responses.

  • propertyCustomETagFactory
    public Func<object, string>? CustomETagFactory { get; init; }

    Gets or sets a custom ETag factory for offset-paginated responses.

  • fieldDefault
    public static readonly PaginationETagOptions Default

    Represents default ETag generation options using SHA-256 content hashing.

class

PaginationEndpointExtensions

Assembly: EricksonLopez.Pagination.AspNetCore
public static class PaginationEndpointExtensions

Provides extension methods for registering pagination validation filters on Minimal API endpoints.

Members (2)

  • methodAddPaginationValidation
    public static RouteGroupBuilder AddPaginationValidation(this RouteGroupBuilder builder)

    Adds pagination validation endpoint filters to the route group builder.

    builder: this RouteGroupBuilder
    The route group builder to configure.

    Returns: The configured `RouteGroupBuilder` instance.

  • methodAddPaginationValidation
    public static RouteHandlerBuilder AddPaginationValidation(this RouteHandlerBuilder builder)

    Adds pagination validation endpoint filters to the route handler builder.

    builder: this RouteHandlerBuilder
    The route handler builder to configure.

    Returns: The configured `RouteHandlerBuilder` instance.

class

PaginationEndpointFilter

Assembly: EricksonLopez.Pagination.AspNetCore
public class PaginationEndpointFilter : IEndpointFilter
Implements: IEndpointFilter

Provides an endpoint filter for Minimal APIs that enforces pagination configuration limits.

Members (1)

  • methodInvokeAsync
    public async ValueTask<object?> InvokeAsync(EndpointFilterInvocationContext context, EndpointFilterDelegate next)

    Inherits documentation from base type or interface.

    context: EndpointFilterInvocationContext
    next: EndpointFilterDelegate
record

PaginationErrorResponse

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed record PaginationErrorResponse(string Error)

Represents a structured error response returned by pagination filters.

Members (3)

  • constructorPaginationErrorResponse
    public PaginationErrorResponse(string Error)

    Initializes a new instance of PaginationErrorResponse.

    Error: string
    The detailed error message.
  • methodToString
    public override string ToString()

    Inherits documentation from base type or interface.

  • propertyError
    public string Error { get; init; }

    The detailed error message.

class

PaginationExceptionHandler

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class PaginationExceptionHandler : Microsoft.AspNetCore.Diagnostics.IExceptionHandler
Implements: Microsoft.AspNetCore.Diagnostics.IExceptionHandler

Provides an exception handler that translates pagination cursor exceptions into HTTP 400 Bad Request responses.

Members (1)

  • methodTryHandleAsync
    public async ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken)

    Inherits documentation from base type or interface.

    httpContext: HttpContext
    exception: Exception
    cancellationToken: CancellationToken
class

PaginationExtensions

Assembly: EricksonLopez.Pagination.AspNetCore
public static class PaginationExtensions

Provides extension methods for converting paginated lists into standardized ASP.NET Core API responses.

Members (4)

  • methodToCursorPagedResponse<T, TKey>
    public static CursorPagedResponse<T> ToCursorPagedResponse<T, TKey>(this ICursorPagedList<T> pagedList, Func<T, TKey> keySelector, ICursorEncoder? cursorEncoder = null) where T : notnull where TKey : notnull

    Converts an `ICursorPagedList<T>` into a standardized `CursorPagedResponse<T>` using a typed key selector.

    pagedList: this ICursorPagedList<T>
    The cursor-paginated list to convert.
    keySelector: Func<T, TKey>
    A function that extracts the unique cursor key from each item.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.

    Returns: A `CursorPagedResponse<T>` containing edges and pagination metadata.

    Type parameters: T: The type of items in the cursor-paginated list.; TKey: The type of the cursor key. Exceptions: ArgumentNullException: `pagedList` or `keySelector` is `null`

  • methodToCursorPagedResponse<T>
    public static CursorPagedResponse<T> ToCursorPagedResponse<T>(this ICursorPagedList<T> pagedList, Func<T, RawCursorValue> rawCursorSelector, ICursorEncoder? cursorEncoder = null) where T : notnull

    Converts an `ICursorPagedList<T>` into a standardized `CursorPagedResponse<T>` using a raw cursor value extractor.

    pagedList: this ICursorPagedList<T>
    The cursor-paginated list to convert.
    rawCursorSelector: Func<T, RawCursorValue>
    A function that extracts the raw cursor value from each item.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder. If `null`, the default encoder is used.

    Returns: A `CursorPagedResponse<T>` containing edges and pagination metadata.

    Type parameters: T: The type of items in the cursor-paginated list. Exceptions: ArgumentNullException: `pagedList` or `rawCursorSelector` is `null`

  • methodToPagedResponse<T>
    public static PagedResponse<T> ToPagedResponse<T>(this IPagedList<T> pagedList, Microsoft.AspNetCore.Http.HttpRequest request)

    Converts an `IPagedList<T>` into a standardized `PagedResponse<T>` using the current request to generate relative HATEOAS links.

    pagedList: this IPagedList<T>
    The paginated list to convert.
    request: Microsoft.AspNetCore.Http.HttpRequest
    The current HTTP request.

    Returns: A standardized `PagedResponse<T>` containing pagination metadata and relative navigation links.

    Type parameters: T: The type of items in the paginated list. Exceptions: ArgumentNullException: `pagedList` or `request` is `null`

  • methodToPagedResponse<T>
    public static PagedResponse<T> ToPagedResponse<T>(this IPagedList<T> pagedList, string? requestUri = null)

    Converts an `IPagedList<T>` into a standardized `PagedResponse<T>` suitable for API responses.

    pagedList: this IPagedList<T>
    The paginated list to convert.
    requestUri: string?
    The original request URI used to generate navigation links.

    Returns: A standardized `PagedResponse<T>` containing pagination metadata.

    Type parameters: T: The type of items in the paginated list. Exceptions: ArgumentNullException: `pagedList` is `null`

class

PaginationJsonSerializerContext

Assembly: EricksonLopez.Pagination.AspNetCore
public partial class PaginationJsonSerializerContext : JsonSerializerContext
Inherits: JsonSerializerContext

Provides a source-generated JSON serializer context for non-generic pagination metadata types.

Members (0)

This type declares 0 public members (e.g. marker interface or empty enum/record).

class

PaginationParametersModelBinder

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class PaginationParametersModelBinder : IModelBinder
Implements: IModelBinder

Provides a model binder for `PaginationParameters` that extracts page and page size parameters from the request.

Members (2)

  • constructorPaginationParametersModelBinder
    public PaginationParametersModelBinder(IOptionsSnapshot<PaginationCoreOptions> options, Microsoft.Extensions.Logging.ILogger<PaginationParametersModelBinder> logger)

    Initializes a new instance of the `PaginationParametersModelBinder` class with the specified options and logger.

    options: IOptionsSnapshot<PaginationCoreOptions>
    The pagination options snapshot resolved per-request.
    logger: Microsoft.Extensions.Logging.ILogger<PaginationParametersModelBinder>
    The logger used for emitting deep offset warnings.
  • methodBindModelAsync
    public Task BindModelAsync(ModelBindingContext bindingContext)

    Inherits documentation from base type or interface.

    bindingContext: ModelBindingContext
class

PaginationParametersModelBinderProvider

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class PaginationParametersModelBinderProvider : IModelBinderProvider
Implements: IModelBinderProvider

Provides a model binder provider for pagination parameter types to the MVC model binding pipeline.

Members (1)

  • methodGetBinder
    public IModelBinder? GetBinder(ModelBinderProviderContext context)

    Inherits documentation from base type or interface.

    context: ModelBinderProviderContext
class

PaginationResultExtensions

Assembly: EricksonLopez.Pagination.AspNetCore
public static class PaginationResultExtensions

Provides extension methods to return paginated lists as `IResult` with HTTP `ETag` and `Cache-Control` headers, and to apply those headers directly to an existing `HttpResponse` for manual response composition.

Members (4)

  • methodApplyETagHeaders<T>
    public static bool ApplyETagHeaders<T>(this CursorPagedResponse<T> response, HttpContext httpContext, TimeSpan? maxAge = null, PaginationETagOptions? etagOptions = null) where T : notnull

    Applies ETag and cache control headers to an HTTP response based on the content of a `CursorPagedResponse<T>` and determines if the cached representation is valid.

    response: this CursorPagedResponse<T>
    The cursor-paginated response whose content is hashed.
    httpContext: HttpContext
    The current HTTP context.
    maxAge: TimeSpan?
    An optional duration for the Cache-Control max-age directive.
    etagOptions: PaginationETagOptions?
    Optional configuration controlling ETag generation strategy.

    Returns: `true` if the cached version matches the computed ETag; otherwise, `false`.

    Type parameters: T: The element type.

  • methodApplyETagHeaders<T>
    public static bool ApplyETagHeaders<T>(this PagedResponse<T> response, HttpContext httpContext, TimeSpan? maxAge = null, PaginationETagOptions? etagOptions = null)

    Applies ETag and cache control headers to an HTTP response based on the content of a `PagedResponse<T>` and determines if the cached representation is valid.

    response: this PagedResponse<T>
    The paginated response whose content is hashed.
    httpContext: HttpContext
    The current HTTP context.
    maxAge: TimeSpan?
    An optional duration for the Cache-Control max-age directive.
    etagOptions: PaginationETagOptions?
    Optional configuration controlling ETag generation strategy.

    Returns: `true` if the cached version matches the computed ETag; otherwise, `false`.

    Type parameters: T: The element type.

  • methodToCursorPagedResult<T, TKey>
    public static IResult ToCursorPagedResult<T, TKey>(this ICursorPagedList<T> pagedList, Func<T, TKey> keySelector, ICursorEncoder? cursorEncoder = null, TimeSpan? maxAge = null) where T : notnull where TKey : notnull

    Converts an `ICursorPagedList<T>` into an `IResult` containing a standardized `CursorPagedResponse<T>` with ETag and cache headers.

    pagedList: this ICursorPagedList<T>
    The cursor-paginated result to convert.
    keySelector: Func<T, TKey>
    A function that extracts the unique cursor key from each item.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder override.
    maxAge: TimeSpan?
    An optional duration for the Cache-Control max-age directive.

    Returns: An `IResult` representing the cursor-paginated response with cache headers.

    Type parameters: T: The element type.; TKey: The cursor key type.

  • methodToPagedResult<T>
    public static IResult ToPagedResult<T>(this IPagedList<T> pagedList, HttpRequest request, TimeSpan? maxAge = null)

    Converts an `IPagedList<T>` into an `IResult` containing a standardized `PagedResponse<T>` with ETag and cache headers.

    pagedList: this IPagedList<T>
    The paginated result to convert.
    request: HttpRequest
    The current HTTP request used to build navigation links.
    maxAge: TimeSpan?
    An optional duration for the Cache-Control max-age directive.

    Returns: An `IResult` representing the paginated response with cache headers.

    Type parameters: T: The element type.

class

PaginationServiceCollectionExtensions

Assembly: EricksonLopez.Pagination.AspNetCore
public static class PaginationServiceCollectionExtensions

Provides extension methods for `IServiceCollection` to register pagination services.

Members (2)

  • methodAddPagination
    public static IServiceCollection AddPagination(this IServiceCollection services, Action<PaginationCoreOptions>? configure = null, Action<PaginationAspNetCoreOptions>? configureAspNetCore = null)

    Registers pagination services, options validation, and MVC model binder providers in the service collection.

    services: this IServiceCollection
    The service collection to register services into.
    configure: Action<PaginationCoreOptions>?
    An optional action to configure pagination core options.
    configureAspNetCore: Action<PaginationAspNetCoreOptions>?
    An optional action to configure ASP.NET Core-specific pagination options.

    Returns: The configured `IServiceCollection` instance.

  • methodAddPaginationCursorEncoder
    public static IServiceCollection AddPaginationCursorEncoder(this IServiceCollection services)

    Registers the default `ICursorEncoder` into the service collection.

    services: this IServiceCollection
    The service collection to register the encoder into.

    Returns: The configured `IServiceCollection` instance.

class

RelayPageInfo

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class RelayPageInfo

Represents pagination metadata about the current cursor-paginated page.

Members (4)

  • propertyEndCursor
    public string? EndCursor { get; init; }

    Gets the opaque cursor of the last item on the page.

  • propertyHasNextPage
    public bool HasNextPage { get; init; }

    Gets a value indicating whether a subsequent page exists.

  • propertyHasPreviousPage
    public bool HasPreviousPage { get; init; }

    Gets a value indicating whether a preceding page exists.

  • propertyStartCursor
    public string? StartCursor { get; init; }

    Gets the opaque cursor of the first item on the page.

class

SortParametersModelBinder

Assembly: EricksonLopez.Pagination.AspNetCore
public sealed class SortParametersModelBinder : IModelBinder
Implements: IModelBinder

Provides a model binder for `SortParameters` that extracts sort expressions from the request.

Members (2)

  • constructorSortParametersModelBinder
    public SortParametersModelBinder(IOptionsSnapshot<PaginationCoreOptions> options)

    Initializes a new instance of the `SortParametersModelBinder` class with the specified options.

    options: IOptionsSnapshot<PaginationCoreOptions>
    The pagination options snapshot resolved per-request.
  • methodBindModelAsync
    public Task BindModelAsync(ModelBindingContext bindingContext)

    Inherits documentation from base type or interface.

    bindingContext: ModelBindingContext

EricksonLopez.Pagination.Blazor#

2
class

PaginationBlazorServiceCollectionExtensions

Assembly: EricksonLopez.Pagination.Blazor
public static class PaginationBlazorServiceCollectionExtensions

Provides extension methods for `IServiceCollection` to register Blazor pagination services.

Members (1)

  • methodAddPaginationBlazor
    public static IServiceCollection AddPaginationBlazor(this IServiceCollection services, Action<PaginationUIOptions>? configure = null)

    Registers Blazor pagination UI options in the service collection.

    services: this IServiceCollection
    The service collection to register options into.
    configure: Action<PaginationUIOptions>?
    An optional action to configure `PaginationUIOptions`.

    Returns: The configured `IServiceCollection` instance.

class

PaginationUIOptions

Assembly: EricksonLopez.Pagination.Blazor
public class PaginationUIOptions

Represents options for configuring default CSS classes used by Blazor pagination components.

Members (10)

  • propertyActiveClass
    public string ActiveClass { get; set; }

    Gets or sets the CSS class applied to the active page item.

  • propertyBootstrap
    public static PaginationUIOptions Bootstrap { get; }

    Gets a predefined set of UI options configured for Bootstrap.

  • propertyBootstrap5
    public static PaginationUIOptions Bootstrap5 { get; }

    Gets a predefined set of UI options configured for Bootstrap 5.

  • propertyContainerClass
    public string ContainerClass { get; set; }

    Gets or sets additional CSS classes for the navigation container element.

  • propertyDisabledClass
    public string DisabledClass { get; set; }

    Gets or sets the CSS class applied to disabled page items.

  • propertyItemClass
    public string ItemClass { get; set; }

    Gets or sets the CSS class for list item elements.

  • propertyLinkClass
    public string LinkClass { get; set; }

    Gets or sets the CSS class for navigation link and button elements.

  • propertyListClass
    public string ListClass { get; set; }

    Gets or sets the CSS class for the unordered list element.

  • propertyPaginationClass
    public string PaginationClass { get; set; }

    Gets or sets additional CSS classes for the pagination container element.

  • propertyTailwind
    public static PaginationUIOptions Tailwind { get; }

    Gets a predefined set of UI options configured for Tailwind CSS.

EricksonLopez.Pagination.Cosmos#

1
class

CosmosPaginationExtensions

Assembly: EricksonLopez.Pagination.Cosmos
public static class CosmosPaginationExtensions

Provides pagination extension methods for Azure Cosmos DB.

Members (4)

  • methodToCursorPagedListAsync<T>
    public static async Task<ICursorPagedList<T>> ToCursorPagedListAsync<T>(this Container container, QueryDefinition queryDefinition, CursorPaginationParameters parameters, ICursorEncoder? cursorEncoder, int? maxPageSize = null, CancellationToken cancellationToken = default)

    Executes a Cosmos DB query and returns a cursor-based paged list using continuation tokens and the specified cursor encoder.

    container: this Container
    The Cosmos DB container.
    queryDefinition: QueryDefinition
    The query definition to execute.
    parameters: CursorPaginationParameters
    The pagination parameters containing continuation token information.
    cursorEncoder: ICursorEncoder?
    The cursor encoder to sign and verify continuation tokens. If `null`, defaults to `DefaultEncoder`.
    maxPageSize: int?
    The maximum allowed page size.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor-paginated list.

    Type parameters: T: The type of the item. Exceptions: NotSupportedException: Backward pagination (`CursorPaginationParameters.Last` or `CursorPaginationParameters.Before`) is requested

  • methodToCursorPagedListAsync<T>
    public static Task<ICursorPagedList<T>> ToCursorPagedListAsync<T>(this Container container, QueryDefinition queryDefinition, CursorPaginationParameters parameters, IServiceProvider serviceProvider, int? maxPageSize = null, CancellationToken cancellationToken = default)

    Executes a Cosmos DB query and resolves `ICursorEncoder` from the provided `IServiceProvider`.

    container: this Container
    queryDefinition: QueryDefinition
    parameters: CursorPaginationParameters
    serviceProvider: IServiceProvider
    maxPageSize: int?
    cancellationToken: CancellationToken
  • methodToCursorPagedListAsync<T>
    public static Task<ICursorPagedList<T>> ToCursorPagedListAsync<T>(this Container container, QueryDefinition queryDefinition, CursorPaginationParameters parameters, int? maxPageSize = null, CancellationToken cancellationToken = default)

    Executes a Cosmos DB query and returns a cursor-based paged list using continuation tokens. Preserves binary compatibility with existing callers.

    container: this Container
    The Cosmos DB container.
    queryDefinition: QueryDefinition
    The query definition to execute.
    parameters: CursorPaginationParameters
    The pagination parameters containing continuation token information.
    maxPageSize: int?
    The maximum allowed page size.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor-paginated list.

    Type parameters: T: The type of the item. Exceptions: NotSupportedException: Backward pagination (`CursorPaginationParameters.Last` or `CursorPaginationParameters.Before`) is requested

  • propertyDefaultEncoder
    public static ICursorEncoder DefaultEncoder { get; set; }

    Gets or sets the default cursor encoder used when no explicit encoder is provided. Defaults to `HmacCursorEncoder.DevelopmentDefault`.

EricksonLopez.Pagination.Dapper#

6
class

CursorSqlBuilder

Assembly: EricksonLopez.Pagination.Dapper
public sealed partial class CursorSqlBuilder

Provides a fluent builder for generating SQL queries tailored for cursor-based keyset pagination.

Members (8)

  • methodBuild
    public string Build(CursorPaginationParameters parameters)

    Builds the complete SQL query string tailored to the provided cursor pagination parameters.

    parameters: CursorPaginationParameters
    The cursor pagination parameters containing window and direction information.

    Returns: The generated SQL query string.

    Exceptions: InvalidOperationException: The FROM clause or ORDER BY clause is missing

  • methodFrom
    public CursorSqlBuilder From(string table)

    Specifies the source table or view expression for the FROM clause.

    table: string
    The table or view expression.

    Returns: The current `CursorSqlBuilder` instance.

    Exceptions: ArgumentNullException: `table` is `null`

  • methodOrderBy
    public CursorSqlBuilder OrderBy(string column, SortDirection direction = SortDirection.Ascending)

    Specifies the primary sorting column and direction for keyset pagination.

    column: string
    The column name to sort by.
    direction: SortDirection
    The sorting direction.

    Returns: The current `CursorSqlBuilder` instance.

    Exceptions: ArgumentNullException: `column` is `null`; ArgumentException: `column` is invalid or exceeds maximum length

  • methodSelect
    public CursorSqlBuilder Select(string columns)

    Specifies the column projection list for the SELECT clause.

    columns: string
    The column list to select.

    Returns: The current `CursorSqlBuilder` instance.

    Exceptions: ArgumentNullException: `columns` is `null`

  • methodThenBy
    public CursorSqlBuilder ThenBy(string column, SortDirection direction = SortDirection.Ascending)

    Specifies a secondary sorting column and direction for tie-breaking in keyset pagination.

    column: string
    The column name to sort by.
    direction: SortDirection
    The sorting direction.

    Returns: The current `CursorSqlBuilder` instance.

    Exceptions: ArgumentNullException: `column` is `null`; ArgumentException: `column` is invalid or exceeds maximum length; InvalidOperationException: `OrderBy` has not been called prior to this method

  • methodUseDialect
    public CursorSqlBuilder UseDialect(DatabaseDialect dialect)

    Specifies the target SQL database dialect for query generation.

    dialect: DatabaseDialect
    The target database dialect.

    Returns: The current `CursorSqlBuilder` instance.

  • methodWhere
    public CursorSqlBuilder Where(string condition)

    Specifies the base filter predicate for the WHERE clause.

    condition: string
    The SQL filter condition.

    Returns: The current `CursorSqlBuilder` instance.

    Exceptions: ArgumentNullException: `condition` is `null`

  • methodWithParameters
    public CursorSqlBuilder WithParameters(string cursorParam = "", string limitParam = "")

    Specifies custom parameter names for cursor and limit placeholders in the generated SQL.

    cursorParam: string
    The parameter prefix or name for the cursor value.
    limitParam: string
    The parameter name for the row limit.

    Returns: The current `CursorSqlBuilder` instance.

    Exceptions: ArgumentNullException: `cursorParam` or `limitParam` is `null`; ArgumentException: `cursorParam` or `limitParam` is invalid

class

DapperKeysetBuilder<T>

Assembly: EricksonLopez.Pagination.Dapper
public sealed class DapperKeysetBuilder<T>

Provides a fluent builder for multi-column keyset pagination queries executed via Dapper.

Remarks:

Type parameters: T: The type to map each row to.

Members (19)

  • constructorDapperKeysetBuilder
    public DapperKeysetBuilder(IDbConnection connection, CursorPaginationParameters parameters)

    Initializes a new instance of the `DapperKeysetBuilder<T>` class for the specified connection and pagination parameters.

    connection: IDbConnection
    The database connection to execute queries against.
    parameters: CursorPaginationParameters
    The cursor pagination parameters defining the window and direction.
  • methodExecuteAsync
    public async Task<ICursorPagedList<T>> ExecuteAsync(CancellationToken cancellationToken = default)

    Builds the SQL query and executes it against the database, returning a cursor-paged list.

    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor-paginated list.

    Exceptions: InvalidOperationException: Cursor column selectors are not configured or SQL generation is invalid

  • methodFrom
    public DapperKeysetBuilder<T> From(string table)

    Inherits documentation from `CursorSqlBuilder.From`.

    table: string
  • methodOrderBy
    public DapperKeysetBuilder<T> OrderBy(string column, SortDirection direction = SortDirection.Ascending)

    Inherits documentation from `CursorSqlBuilder.OrderBy`.

    column: string
    direction: SortDirection
  • methodSelect
    public DapperKeysetBuilder<T> Select(string columns)

    Inherits documentation from `CursorSqlBuilder.Select`.

    columns: string
  • methodThenBy
    public DapperKeysetBuilder<T> ThenBy(string column, SortDirection direction = SortDirection.Ascending)

    Inherits documentation from `CursorSqlBuilder.ThenBy`.

    column: string
    direction: SortDirection
  • methodUseDialect
    public DapperKeysetBuilder<T> UseDialect(DatabaseDialect dialect)

    Inherits documentation from `CursorSqlBuilder.UseDialect`.

    dialect: DatabaseDialect
  • methodWhere
    public DapperKeysetBuilder<T> Where(string condition)

    Inherits documentation from `CursorSqlBuilder.Where`.

    condition: string
  • methodWithAutoReverse
    public DapperKeysetBuilder<T> WithAutoReverse(bool autoReverse)

    Configures whether backward pagination results are automatically reversed in-memory.

    autoReverse: bool
    A value indicating whether to automatically reverse backward pages.

    Returns: The current `DapperKeysetBuilder<T>` instance.

  • methodWithCommandTimeout
    public DapperKeysetBuilder<T> WithCommandTimeout(int commandTimeout)

    Configures the command timeout in seconds.

    commandTimeout: int
    The command timeout duration in seconds.

    Returns: The current `DapperKeysetBuilder<T>` instance.

  • methodWithCommandType
    public DapperKeysetBuilder<T> WithCommandType(CommandType commandType)

    Configures the command type.

    commandType: CommandType
    The command type to execute.

    Returns: The current `DapperKeysetBuilder<T>` instance.

  • methodWithCursorColumns
    public DapperKeysetBuilder<T> WithCursorColumns(params Func<T, string?>[] selectors)

    Specifies the selector functions used to extract cursor key string values from each item.

    selectors: params Func<T, string?>[]
    One selector per keyset column, in order.

    Returns: The current `DapperKeysetBuilder<T>` instance.

    Exceptions: ArgumentNullException: `selectors` is `null`; ArgumentException: `selectors` is empty

  • methodWithCursorDecoder
    public DapperKeysetBuilder<T> WithCursorDecoder(params Func<string[], object?>[] decoders)

    Specifies the decoder functions used to transform raw cursor parts into typed Dapper parameters.

    decoders: params Func<string[], object?>[]
    One decoder per keyset column, in order.

    Returns: The current `DapperKeysetBuilder<T>` instance.

    Exceptions: ArgumentNullException: `decoders` is `null`; ArgumentException: `decoders` is empty

  • methodWithDefaultPageSize
    public DapperKeysetBuilder<T> WithDefaultPageSize(int defaultPageSize)

    Configures the default page size when none is specified in parameters.

    defaultPageSize: int
    The fallback page size.

    Returns: The current `DapperKeysetBuilder<T>` instance.

    Exceptions: ArgumentOutOfRangeException: `defaultPageSize` is less than 1

  • methodWithEncoder
    public DapperKeysetBuilder<T> WithEncoder(ICursorEncoder encoder)

    Configures the cursor encoder for signing and verifying cursors.

    encoder: ICursorEncoder
    The cursor encoder implementation.

    Returns: The current `DapperKeysetBuilder<T>` instance.

    Exceptions: ArgumentNullException: `encoder` is `null`

  • methodWithFactory
    public DapperKeysetBuilder<T> WithFactory(ICursorPagedListFactory factory)

    Configures the factory used to instantiate cursor paged lists.

    factory: ICursorPagedListFactory
    The custom factory implementation.

    Returns: The current `DapperKeysetBuilder<T>` instance.

    Exceptions: ArgumentNullException: `factory` is `null`

  • methodWithMaxPageSize
    public DapperKeysetBuilder<T> WithMaxPageSize(int maxPageSize)

    Configures the maximum allowed page size.

    maxPageSize: int
    The maximum allowed page size.

    Returns: The current `DapperKeysetBuilder<T>` instance.

    Exceptions: ArgumentOutOfRangeException: `maxPageSize` is less than 1

  • methodWithParam
    public DapperKeysetBuilder<T> WithParam(object? param)

    Configures additional user-defined SQL parameters.

    param: object?
    An object or anonymous type containing SQL parameter values.

    Returns: The current `DapperKeysetBuilder<T>` instance.

  • methodWithTransaction
    public DapperKeysetBuilder<T> WithTransaction(IDbTransaction? transaction)

    Configures the database transaction for the query.

    transaction: IDbTransaction?
    The active transaction, or `null`.

    Returns: The current `DapperKeysetBuilder<T>` instance.

enum

DatabaseDialect

Assembly: EricksonLopez.Pagination.Dapper
public enum DatabaseDialect

Specifies the database dialect for SQL generation.

Members (4)

  • fieldMySql
    MySql

    Specifies the MySQL database dialect.

  • fieldPostgreSql
    PostgreSql

    Specifies the PostgreSQL database dialect.

  • fieldSqlServer
    SqlServer

    Specifies the Microsoft SQL Server database dialect.

  • fieldSqlite
    Sqlite

    Specifies the SQLite database dialect.

class

DbConnectionCursorExtensions

Assembly: EricksonLopez.Pagination.Dapper
public static class DbConnectionCursorExtensions

Provides extension methods for `IDbConnection` to execute cursor-paginated queries using Dapper.

Members (5)

  • methodToCursorPagedAsyncEnumerable<T, TKey>
    public static async IAsyncEnumerable<T> ToCursorPagedAsyncEnumerable<T, TKey>(this IDbConnection connection, string sql, CursorPaginationParameters parameters, Func<T, TKey> keySelector, Func<string, TKey>? cursorDecoder = null, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Executes a cursor-paginated SQL query and streams the results asynchronously.

    connection: this IDbConnection
    The database connection to execute the query against.
    sql: string
    The SQL query string.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    keySelector: Func<T, TKey>
    A function that extracts the raw cursor value from each result item.
    cursorDecoder: Func<string, TKey>?
    An optional function to convert the decoded cursor string to `TKey`.
    param: object?
    Additional user-defined query parameters.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    defaultPageSize: int
    The fallback page size if not provided by the parameters.
    maxPageSize: int?
    The maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT decoders.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An async stream yielding entities sequentially.

    Type parameters: T: The type to map each row to.; TKey: The type of the cursor key. Exceptions: InvalidOperationException: Backward pagination is requested for streaming

  • methodToCursorPagedListAsync<T, TKey1, TKey2>
    public static async Task<ICursorPagedList<T>> ToCursorPagedListAsync<T, TKey1, TKey2>(this IDbConnection connection, string sql, CursorPaginationParameters parameters, Func<T,(TKey1, TKey2)> keySelector, Func<string,(TKey1, TKey2)>? cursorDecoder = null, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorPagedListFactory? factory = null, bool autoReverse = true, CancellationToken cancellationToken = default)

    Executes a composite cursor-based paginated SQL query with two keys and returns a `CursorPagedList<T>`.

    connection: this IDbConnection
    The database connection to execute the query against.
    sql: string
    The SQL query string.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    keySelector: Func<T,(TKey1, TKey2)>
    A function extracting the composite key from each item.
    cursorDecoder: Func<string,(TKey1, TKey2)>?
    An optional function to decode the composite cursor string.
    param: object?
    Additional user-defined query parameters.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    defaultPageSize: int
    The fallback page size if not provided by the parameters.
    maxPageSize: int?
    The maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the paginated list.
    autoReverse: bool
    A value indicating whether to reverse results in-memory during backward pagination.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor-paginated list.

    Type parameters: T: The type to map each row to.; TKey1: The type of the primary sort column.; TKey2: The type of the secondary tie-breaker sort column.

  • methodToCursorPagedListAsync<T, TKey>
    public static async Task<ICursorPagedList<T>> ToCursorPagedListAsync<T, TKey>(this IDbConnection connection, string sql, CursorPaginationParameters parameters, Func<T, TKey> keySelector, Func<string, TKey>? cursorDecoder = null, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorPagedListFactory? factory = null, ICursorDecoderRegistry? decoderRegistry = null, bool autoReverse = true, CancellationToken cancellationToken = default)

    Executes a cursor-paginated SQL query and returns a `CursorPagedList<T>`.

    connection: this IDbConnection
    The database connection to execute the query against.
    sql: string
    The SQL query string.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    keySelector: Func<T, TKey>
    A function that extracts the raw cursor value from each result item.
    cursorDecoder: Func<string, TKey>?
    An optional function to convert the decoded cursor string to `TKey`.
    param: object?
    Additional user-defined query parameters.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    defaultPageSize: int
    The fallback page size if not provided by the parameters.
    maxPageSize: int?
    The maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the paginated list.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT decoders.
    autoReverse: bool
    A value indicating whether to reverse results in-memory during backward pagination.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor-paginated list.

    Type parameters: T: The type to map each row to.; TKey: The type of the cursor key. Exceptions: InvalidOperationException: The cursor value cannot be converted to `TKey`

  • methodToStreamingAsyncEnumerable<T, TKey1, TKey2>
    public static async IAsyncEnumerable<T> ToStreamingAsyncEnumerable<T, TKey1, TKey2>(this IDbConnection connection, string sql, CursorPaginationParameters parameters, Func<T, TKey1> key1Selector, Func<T, TKey2> key2Selector, Func<string,(TKey1, TKey2)>? cursorDecoder = null, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int chunkSize = 1000, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Streams all records matching the query sequentially by automatically paginating through 2-column keyset chunks.

    connection: this IDbConnection
    The database connection to execute queries against.
    sql: string
    The SQL query string.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    key1Selector: Func<T, TKey1>
    A function that extracts the first key component from each result item.
    key2Selector: Func<T, TKey2>
    A function that extracts the second key component from each result item.
    cursorDecoder: Func<string,(TKey1, TKey2)>?
    An optional function to convert the decoded cursor string to composite keys.
    param: object?
    Additional user-defined query parameters.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    chunkSize: int
    The page chunk size to retrieve per batch.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT decoders.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An async stream yielding entities sequentially across all chunks.

    Type parameters: T: The type to map each row to.; TKey1: The type of the primary cursor key.; TKey2: The type of the secondary tie-breaker cursor key. Exceptions: InvalidOperationException: Backward pagination is requested for streaming

  • methodToStreamingAsyncEnumerable<T, TKey>
    public static async IAsyncEnumerable<T> ToStreamingAsyncEnumerable<T, TKey>(this IDbConnection connection, string sql, CursorPaginationParameters parameters, Func<T, TKey> keySelector, Func<string, TKey>? cursorDecoder = null, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int chunkSize = 1000, ICursorEncoder? cursorEncoder = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Streams all records matching the query sequentially by automatically paginating through keyset chunks.

    connection: this IDbConnection
    The database connection to execute queries against.
    sql: string
    The SQL query string.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    keySelector: Func<T, TKey>
    A function that extracts the raw cursor value from each result item.
    cursorDecoder: Func<string, TKey>?
    An optional function to convert the decoded cursor string to `TKey`.
    param: object?
    Additional user-defined query parameters.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    chunkSize: int
    The page chunk size to retrieve per batch.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    decoderRegistry: ICursorDecoderRegistry?
    An optional registry for AOT decoders.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An async stream yielding entities sequentially across all chunks.

    Type parameters: T: The type to map each row to.; TKey: The type of the cursor key. Exceptions: InvalidOperationException: Backward pagination is requested for streaming

class

DbConnectionPaginationExtensions

Assembly: EricksonLopez.Pagination.Dapper
public static class DbConnectionPaginationExtensions

Provides extension methods for `IDbConnection` to execute offset-paginated queries using Dapper.

Members (2)

  • methodToPagedAsyncEnumerable<T>
    public static async IAsyncEnumerable<T> ToPagedAsyncEnumerable<T>(this IDbConnection connection, string sql, PaginationParameters parameters, object? param = null, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int? maxPageSize = 1000, CancellationToken cancellationToken = default)

    Executes a paginated SQL query and returns a streaming asynchronous sequence of items.

    connection: this IDbConnection
    The database connection to execute the query against.
    sql: string
    The SQL query string.
    parameters: PaginationParameters
    The pagination parameters defining the requested page and page size.
    param: object?
    Additional user-defined query parameters.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    maxPageSize: int?
    The maximum allowed page size.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An `IAsyncEnumerable<T>` yielding items for the requested page.

    Type parameters: T: The type to map each row to. Exceptions: InvalidOperationException: The param object contains a reserved pagination parameter name

  • methodToPagedListAsync<T>
    public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IDbConnection connection, string sql, PaginationParameters parameters, object? param = null, bool countTotal = true, IDbTransaction? transaction = null, int? commandTimeout = null, CommandType? commandType = null, int? maxPageSize = 1000, IPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Executes a paginated SQL query and returns a `PagedList<T>`.

    connection: this IDbConnection
    The database connection to execute the query against.
    sql: string
    The SQL query string.
    parameters: PaginationParameters
    The pagination parameters defining the requested page and page size.
    param: object?
    Additional user-defined query parameters.
    countTotal: bool
    A value indicating whether the query returns total record count.
    transaction: IDbTransaction?
    An optional database transaction.
    commandTimeout: int?
    An optional command timeout in seconds.
    commandType: CommandType?
    An optional command type.
    maxPageSize: int?
    The maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The type to map each row to. Exceptions: InvalidOperationException: The param object contains a reserved pagination parameter name or the query did not return a valid count when requested

class

GridReaderPaginationExtensions

Assembly: EricksonLopez.Pagination.Dapper
public static class GridReaderPaginationExtensions

Provides extension methods for Dapper's `SqlMapper.GridReader` to read paginated results.

Members (1)

  • methodReadPagedListAsync<T>
    public static async Task<IPagedList<T>> ReadPagedListAsync<T>(this SqlMapper.GridReader multi, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = 1000, IPagedListFactory? factory = null)

    Reads a paginated result set from a Dapper grid reader.

    multi: this SqlMapper.GridReader
    The grid reader to read results from.
    parameters: PaginationParameters
    The pagination parameters defining the requested page and page size.
    countTotal: bool
    A value indicating whether the first result set contains the total record count.
    maxPageSize: int?
    The maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The type of elements in the paginated list. Exceptions: ArgumentNullException: `multi` is `null`; InvalidOperationException: The first result set does not return a valid count when `countTotal` is `true`

EricksonLopez.Pagination.Elasticsearch#

2
class

ElasticsearchCursorHelper

Assembly: EricksonLopez.Pagination.Elasticsearch
public static class ElasticsearchCursorHelper

Provides methods for encoding and decoding Elasticsearch `search_after` sort tokens.

Members (3)

  • methodDecodeSort
    public static FieldValue[]? DecodeSort(string? cursor, ICursorEncoder? encoder = null)

    Decodes an opaque pagination cursor into Elasticsearch `FieldValue` elements for `search_after`.

    cursor: string?
    The opaque cursor string.
    encoder: ICursorEncoder?
    The cursor encoder to use, or `null` for default HMAC encoder.

    Returns: An array of `FieldValue` objects, or `null` if `cursor` is `null` or empty.

  • methodEncodeSort
    public static string? EncodeSort(IReadOnlyCollection<FieldValue>? sortFields, ICursorEncoder? encoder = null)

    Encodes an Elasticsearch sort array into an opaque pagination cursor string.

    sortFields: IReadOnlyCollection<FieldValue>?
    The sort values returned on a search hit.
    encoder: ICursorEncoder?
    The cursor encoder to use, or `null` for default HMAC encoder.

    Returns: An opaque cursor string, or `null` if `sortFields` is empty.

  • propertyDefaultEncoder
    public static ICursorEncoder DefaultEncoder { get; set; }

    Gets or sets the default cursor encoder used when no explicit encoder is provided. Defaults to `HmacCursorEncoder.DevelopmentDefault`.

class

ElasticsearchCursorPaginationExtensions

Assembly: EricksonLopez.Pagination.Elasticsearch
public static class ElasticsearchCursorPaginationExtensions

Provides extension methods for integrating Elasticsearch search requests and responses with the EricksonLopez.Pagination cursor ecosystem.

Members (2)

  • methodApplyCursorPagination<T>
    public static SearchRequestDescriptor<T> ApplyCursorPagination<T>(this SearchRequestDescriptor<T> descriptor, CursorPaginationParameters parameters, ICursorEncoder? encoder = null)

    Configures an Elasticsearch `SearchRequestDescriptor<T>` with pagination size and decoded `search_after` cursor token.

    descriptor: this SearchRequestDescriptor<T>
    The search request descriptor.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    encoder: ICursorEncoder?
    Optional cursor encoder for decoding `CursorPaginationParameters.After`.

    Returns: The modified search request descriptor.

    Type parameters: T: The document type. Exceptions: ArgumentNullException: `descriptor` is `null`

  • methodToCursorPagedList<T>
    public static CursorPagedList<T> ToCursorPagedList<T>(this SearchResponse<T> response, CursorPaginationParameters parameters, ICursorEncoder? encoder = null)

    Materializes an Elasticsearch `SearchResponse<T>` into an immutable `CursorPagedList<T>`.

    response: this SearchResponse<T>
    The search response returned by Elasticsearch.
    parameters: CursorPaginationParameters
    The pagination parameters used to execute the search.
    encoder: ICursorEncoder?
    Optional cursor encoder for encoding `ICursorPagedList.StartCursor` and `ICursorPagedList.EndCursor`.

    Returns: An immutable `CursorPagedList<T>` containing the documents and pagination cursors.

    Type parameters: T: The document type. Exceptions: ArgumentNullException: `response` is `null`

EricksonLopez.Pagination.EntityFrameworkCore#

9
class

KeysetBuilder<T>

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public sealed class KeysetBuilder<T>

Provides a fluent builder for constructing multi-column keyset pagination queries.

Remarks:

Type parameters: T: The entity type.

Members (11)

  • methodAscending
    public KeysetBuilder<T> Ascending(string propertyName, IEnumerable<string>? allowedProperties = null)

    Adds a column to the keyset in ascending order using a property name.

    propertyName: string
    The name of the property to sort by.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of permitted property names.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Exceptions: ArgumentException: `propertyName` is invalid or not found on type `T`; InvalidOperationException: The resolved property is a nullable type

  • methodAscending<TProp>
    public KeysetBuilder<T> Ascending<TProp>(Expression<Func<T, TProp>> selector)

    Adds a column to the keyset in ascending order.

    selector: Expression<Func<T, TProp>>
    An expression specifying the property to sort by.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Type parameters: TProp: The property type to sort by. Exceptions: ArgumentNullException: `selector` is `null`; InvalidOperationException: `TProp` is a nullable type

  • methodDescending
    public KeysetBuilder<T> Descending(string propertyName, IEnumerable<string>? allowedProperties = null)

    Adds a column to the keyset in descending order using a property name.

    propertyName: string
    The name of the property to sort by.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of permitted property names.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Exceptions: ArgumentException: `propertyName` is invalid or not found on type `T`; InvalidOperationException: The resolved property is a nullable type

  • methodDescending<TProp>
    public KeysetBuilder<T> Descending<TProp>(Expression<Func<T, TProp>> selector)

    Adds a column to the keyset in descending order.

    selector: Expression<Func<T, TProp>>
    An expression specifying the property to sort by.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Type parameters: TProp: The property type to sort by. Exceptions: ArgumentNullException: `selector` is `null`; InvalidOperationException: `TProp` is a nullable type

  • methodGetKeysetSchemaFingerprint
    public string GetKeysetSchemaFingerprint()

    Computes a deterministic fingerprint for the keyset schema based on column types and sort directions.

    Returns: An 8-character uppercase hexadecimal string uniquely identifying the keyset schema.

  • methodSortBy
    public KeysetBuilder<T> SortBy(SortParameters parameters, IEnumerable<string>? allowedProperties = null)

    Applies dynamic sorting parameters to the keyset builder.

    parameters: SortParameters
    The structured sort parameters.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of permitted property names.

    Returns: A new `KeysetBuilder<T>` instance containing the parsed sort columns.

    Exceptions: ArgumentException: A specified property is invalid or not found on type `T`; InvalidOperationException: A resolved property is a nullable type

  • methodToCursorPagedListAsync
    public async Task<ICursorPagedList<T>> ToCursorPagedListAsync(ICursorPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the query into a `CursorPagedList<T>` using keyset pagination.

    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor paged list.

    Exceptions: InvalidOperationException: No keyset columns have been configured

  • methodToCursorPagedListAsync<TResult>
    public async Task<ICursorPagedList<TResult>> ToCursorPagedListAsync<TResult>(Expression<Func<T, TResult>> selector, ICursorPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the query into a projected `CursorPagedList<TResult>` using keyset pagination.

    selector: Expression<Func<T, TResult>>
    A server-side projection expression from `T` to `TResult`.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the projected cursor paged list.

    Type parameters: TResult: The projected result type. Exceptions: ArgumentNullException: `selector` is `null`; InvalidOperationException: No keyset columns have been configured, or more than 16 columns are configured

  • methodToPagedAsyncEnumerable
    public IAsyncEnumerable<T> ToPagedAsyncEnumerable()

    Returns an `IAsyncEnumerable<T>` that asynchronously streams entities for the requested keyset page.

    Returns: An `IAsyncEnumerable<T>` yielding entities sequentially.

    Exceptions: InvalidOperationException: No keyset columns have been configured, or backward pagination is requested

  • methodToStreamingAsyncEnumerable
    public async IAsyncEnumerable<T> ToStreamingAsyncEnumerable(int chunkSize = 1000, CancellationToken cancellationToken = default)

    Streams all records matching the query sequentially by automatically paginating through keyset chunks.

    chunkSize: int
    The number of items to retrieve per database chunk.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An async stream yielding entities sequentially across all chunks.

    Exceptions: InvalidOperationException: No keyset columns have been configured, or backward pagination is requested

  • methodWithTenant
    public KeysetBuilder<T> WithTenant(string tenantId)

    Binds the keyset pagination query to a specific tenant identifier. The tenant identifier is included in the keyset schema fingerprint to ensure cursors issued for one tenant cannot be used to paginate another tenant's data.

    tenantId: string
    The tenant identifier.

    Returns: A new `KeysetBuilder<T>` instance scoped to the specified tenant.

    Exceptions: ArgumentException: `tenantId` is null or whitespace

record

KeysetPartition<TKey>

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public sealed record KeysetPartition<TKey>(int PartitionIndex, TKey? LowerBound, TKey? UpperBound, string? StartCursor, string? EndCursor)

Represents a bounded keyset partition for parallel execution.

Remarks:

Type parameters: TKey: The key type.

Members (6)

  • constructorKeysetPartition
    public KeysetPartition(int PartitionIndex, TKey? LowerBound, TKey? UpperBound, string? StartCursor, string? EndCursor)

    Initializes a new instance of KeysetPartition<TKey>.

    PartitionIndex: int
    The zero-based partition index.
    LowerBound: TKey?
    The inclusive lower bound key (null for first partition).
    UpperBound: TKey?
    The exclusive upper bound key (null for last partition).
    StartCursor: string?
    The encoded start cursor for this partition.
    EndCursor: string?
    The encoded end cursor for this partition.

    Type parameters: TKey: The key type.

  • propertyEndCursor
    public string? EndCursor { get; init; }

    The encoded end cursor for this partition.

  • propertyLowerBound
    public TKey? LowerBound { get; init; }

    The inclusive lower bound key (null for first partition).

  • propertyPartitionIndex
    public int PartitionIndex { get; init; }

    The zero-based partition index.

  • propertyStartCursor
    public string? StartCursor { get; init; }

    The encoded start cursor for this partition.

  • propertyUpperBound
    public TKey? UpperBound { get; init; }

    The exclusive upper bound key (null for last partition).

class

KeysetPartitioningExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static class KeysetPartitioningExtensions

Provides extension methods to partition a keyset queryable into multiple disjoint ranges for parallel worker processing.

Members (4)

  • methodPartitionByKeysetAsync<T>
    public static Task<IReadOnlyList<KeysetPartition<int>>> PartitionByKeysetAsync<T>(this IQueryable<T> source, Expression<Func<T, int>> keySelector, int partitionCount, ICursorEncoder? cursorEncoder = null, CancellationToken cancellationToken = default)

    Partitions an integer-keyed query into disjoint ranges for parallel worker processing. Alias for `SplitKeysetPartitionsAsync<T>(IQueryable<T>, Expression<Func<T, int>>, int, ICursorEncoder?, CancellationToken)`.

    source: this IQueryable<T>
    The source queryable to partition.
    keySelector: Expression<Func<T, int>>
    An expression selecting the integer key.
    partitionCount: int
    The number of parallel partitions to create.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation, containing the list of keyset partitions.

    Type parameters: T: The entity type.

  • methodPartitionByKeysetAsync<T>
    public static Task<IReadOnlyList<KeysetPartition<long>>> PartitionByKeysetAsync<T>(this IQueryable<T> source, Expression<Func<T, long>> keySelector, int partitionCount, ICursorEncoder? cursorEncoder = null, CancellationToken cancellationToken = default)

    Partitions a 64-bit integer-keyed query into disjoint ranges for parallel worker processing. Alias for `SplitKeysetPartitionsAsync<T>(IQueryable<T>, Expression<Func<T, long>>, int, ICursorEncoder?, CancellationToken)`.

    source: this IQueryable<T>
    The source queryable to partition.
    keySelector: Expression<Func<T, long>>
    An expression selecting the long integer key.
    partitionCount: int
    The number of parallel partitions to create.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation, containing the list of keyset partitions.

    Type parameters: T: The entity type.

  • methodSplitKeysetPartitionsAsync<T>
    public static async Task<IReadOnlyList<KeysetPartition<int>>> SplitKeysetPartitionsAsync<T>(this IQueryable<T> source, Expression<Func<T, int>> keySelector, int partitionCount, ICursorEncoder? cursorEncoder = null, CancellationToken cancellationToken = default)

    Divides an integer-keyed query into disjoint partitions based on minimum and maximum key boundaries.

    source: this IQueryable<T>
    The source queryable to partition.
    keySelector: Expression<Func<T, int>>
    An expression selecting the integer key.
    partitionCount: int
    The number of parallel partitions to create.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the list of keyset partitions.

    Type parameters: T: The entity type. Exceptions: ArgumentNullException: `source` or `keySelector` is `null`; ArgumentOutOfRangeException: `partitionCount` is less than or equal to zero

  • methodSplitKeysetPartitionsAsync<T>
    public static async Task<IReadOnlyList<KeysetPartition<long>>> SplitKeysetPartitionsAsync<T>(this IQueryable<T> source, Expression<Func<T, long>> keySelector, int partitionCount, ICursorEncoder? cursorEncoder = null, CancellationToken cancellationToken = default)

    Divides a 64-bit integer-keyed query into disjoint partitions based on minimum and maximum key boundaries.

    source: this IQueryable<T>
    The source queryable to partition.
    keySelector: Expression<Func<T, long>>
    An expression selecting the long integer key.
    partitionCount: int
    The number of parallel partitions to create.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the list of keyset partitions.

    Type parameters: T: The entity type. Exceptions: ArgumentNullException: `source` or `keySelector` is `null`; ArgumentOutOfRangeException: `partitionCount` is less than or equal to zero

class

KeysetStreamingExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static class KeysetStreamingExtensions

Provides extension methods for streaming keyset-paginated queries using `IAsyncEnumerable<T>`.

Members (1)

  • methodAsKeysetStreamAsync<T, TKey>
    public static IAsyncEnumerable<T> AsKeysetStreamAsync<T, TKey>(this IQueryable<T> source, Expression<Func<T, TKey>> keySelector, SortDirection direction = SortDirection.Ascending, int batchSize = 1000, ICursorEncoder? cursorEncoder = null, CancellationToken cancellationToken = default)

    Streams all records matching the query using single-column keyset pagination with on-demand batch fetching.

    source: this IQueryable<T>
    The source queryable to stream from.
    keySelector: Expression<Func<T, TKey>>
    An expression selecting the cursor key column.
    direction: SortDirection
    The sorting direction.
    batchSize: int
    The number of items to fetch per database query.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An `IAsyncEnumerable<T>` yielding entities sequentially.

    Type parameters: T: The entity type.; TKey: The cursor key type. Exceptions: ArgumentNullException: `source` or `keySelector` is `null`; ArgumentOutOfRangeException: `batchSize` is less than or equal to zero

class

OraclePaginationExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static partial class OraclePaginationExtensions

Provides Oracle-specific optimization helpers for pagination.

Members (1)

  • methodGetOracleApproximateCountAsync
    public static async Task<long> GetOracleApproximateCountAsync(this DbContext dbContext, string tableName, string? schemaName = null, CancellationToken cancellationToken = default)

    Retrieves the approximate total count of rows in an Oracle table using database table statistics.

    dbContext: this DbContext
    The EF Core database context.
    tableName: string
    The name of the table in Oracle.
    schemaName: string?
    An optional schema owner name.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the approximate row count.

    Exceptions: ArgumentNullException: `dbContext` is `null`; ArgumentException: `tableName` or `schemaName` is invalid

class

PostgreSqlPaginationExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static partial class PostgreSqlPaginationExtensions

Provides PostgreSQL-specific optimization helpers for pagination.

Members (2)

  • methodBuildRowValuePredicate
    public static (string Sql, Dictionary<string, object> Parameters) BuildRowValuePredicate(IReadOnlyList<string> columns, IReadOnlyList<object> values, bool lessThan)

    Builds a parameterized PostgreSQL row-value comparison predicate for multi-column keyset pagination.

    columns: IReadOnlyList<string>
    The ordered list of column identifiers.
    values: IReadOnlyList<object>
    The cursor values to compare against.
    lessThan: bool
    A value indicating whether to generate a less-than comparison for backward pagination.

    Returns: A tuple containing the generated SQL predicate fragment and dictionary of query parameters.

    Exceptions: ArgumentNullException: `columns` or `values` is `null`; ArgumentException: `columns` is empty, lengths mismatch, or column names are invalid

  • methodGetApproximateCountAsync
    public static async Task<long> GetApproximateCountAsync(this DbContext dbContext, string tableName, string schemaName = "", CancellationToken cancellationToken = default)

    Retrieves the approximate total count of rows in a PostgreSQL table using catalog statistics.

    dbContext: this DbContext
    The EF Core database context.
    tableName: string
    The name of the table in PostgreSQL.
    schemaName: string
    The schema name containing the table.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the approximate row count.

    Exceptions: ArgumentNullException: `dbContext` is `null`; ArgumentException: `tableName` or `schemaName` is invalid

class

QueryableExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static class QueryableExtensions

Provides extension methods for EF Core `IQueryable<T>` to create paginated results.

Remarks:

Native AOT: The cursor-based methods (`ToCursorPagedListAsync` and their overloads) use `Expression.Compile()` internally and are not compatible with Native AOT. For AOT scenarios, use the Dapper extensions with manually-written SQL.

Members (13)

  • methodApplyFilter<T>
    public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, FilterParameters parameters, IFilterOperatorProvider<T> customOperatorProvider, int maxComplexity = 20, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.ThrowException, IEnumerable<string>? allowedProperties = null, IPaginationOptions? options = null)

    Applies dynamic string filtering to the queryable source with custom operator support.

    source: this IQueryable<T>
    The queryable source to filter.
    parameters: FilterParameters
    The filter parameters.
    customOperatorProvider: IFilterOperatorProvider<T>
    The custom operator provider defining additional filter operators.
    maxComplexity: int
    The maximum allowed clause complexity for the filter expression.
    unknownFieldBehavior: FilterUnknownFieldBehavior
    The behavior when an unrecognized field is encountered.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of property names permitted for filtering.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.

    Type parameters: T: The entity type. Exceptions: ArgumentNullException: `source` or `customOperatorProvider` is `null`; ArgumentException: `parameters` exceeds the maximum permitted length

  • methodApplyFilter<T>
    public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, FilterParameters parameters, int maxComplexity = 20, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.ThrowException, IEnumerable<string>? allowedProperties = null, IPaginationOptions? options = null)

    Applies dynamic string filtering to the queryable source.

    source: this IQueryable<T>
    The queryable source to filter.
    parameters: FilterParameters
    The filter parameters.
    maxComplexity: int
    The maximum allowed clause complexity for the filter expression.
    unknownFieldBehavior: FilterUnknownFieldBehavior
    The behavior when an unrecognized field is encountered.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of property names permitted for filtering.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.

    Type parameters: T: The entity type. Exceptions: ArgumentNullException: `source` is `null`; ArgumentException: `parameters` exceeds the maximum permitted length

  • methodApplyFilter<T>
    public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, IFilterProvider<T> filterProvider, FilterParameters parameters)

    Applies a strongly typed filter provider to the queryable source.

    source: this IQueryable<T>
    The queryable source to filter.
    filterProvider: IFilterProvider<T>
    The strongly typed filter provider.
    parameters: FilterParameters
    The filter parameters.

    Returns: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.

    Type parameters: T: The entity type. Exceptions: ArgumentNullException: `source` or `filterProvider` is `null`

  • methodApplySort<T>
    public static IQueryable<T> ApplySort<T>(this IQueryable<T> source, SortParameters sortBy, SortDirection direction = SortDirection.Ascending, Expression<Func<T, object>>? defaultSort = null, IEnumerable<string>? allowedProperties = null)

    Applies dynamic multi-column sorting to the queryable source.

    source: this IQueryable<T>
    The queryable source to sort.
    sortBy: SortParameters
    The sort parameters containing property names and directions.
    direction: SortDirection
    The default sorting direction if not specified in sort parameters.
    defaultSort: Expression<Func<T, object>>?
    An optional fallback sorting expression.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of property names permitted for sorting.

    Returns: An `IQueryable<T>` with ordering applied.

    Type parameters: T: The entity type.

  • methodKeyset<T>
    public static KeysetBuilder<T> Keyset<T>(this IQueryable<T> source, CursorPaginationParameters parameters, int defaultPageSize = 10, ICursorEncoder? cursorEncoder = null, bool acceptLegacyCursors = true)

    Initializes a builder for N-column keyset pagination.

    source: this IQueryable<T>
    The queryable source to paginate.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    defaultPageSize: int
    The fallback page size when not specified in parameters.
    cursorEncoder: ICursorEncoder?
    An optional custom cursor encoder.
    acceptLegacyCursors: bool
    A value indicating whether to accept legacy v1 cursor formats.

    Returns: A new `KeysetBuilder<T>` instance.

    Type parameters: T: The entity type.

  • methodToPagedAsyncEnumerable<T>
    public static IAsyncEnumerable<T> ToPagedAsyncEnumerable<T>(this IQueryable<T> source, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null)

    Returns an `IAsyncEnumerable<T>` that asynchronously streams entities for the requested page.

    source: this IQueryable<T>
    The queryable source to stream from.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    maxPageSize: int?
    The maximum allowed page size.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: An `IAsyncEnumerable<T>` yielding entities sequentially.

    Type parameters: T: The entity type.

  • methodToPagedListAsync<T, TResult>
    public static async Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = null, bool useApproximateCount = false, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Materializes the query into a projected `PagedList<TResult>` using offset pagination.

    source: this IQueryable<T>
    The queryable source to paginate.
    selector: Expression<Func<T, TResult>>
    A projection expression applied on the database server.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    The maximum allowed page size.
    useApproximateCount: bool
    A value indicating whether to use database table statistics for approximate counting.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list.

    Type parameters: T: The entity type.; TResult: The projected result type.

  • methodToPagedListAsync<T, TResult>
    public static Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, FilterParameters filter, SortParameters sortBy, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, bool useApproximateCount = false, int? maxPageSize = null, IEnumerable<string>? allowedProperties = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Applies dynamic filtering, sorting, server-side projection, and offset pagination in a single operation.

    source: this IQueryable<T>
    The queryable source to filter, sort, project, and paginate.
    filter: FilterParameters
    The dynamic filter parameters.
    sortBy: SortParameters
    The dynamic sort parameters.
    selector: Expression<Func<T, TResult>>
    A projection expression applied on the database server.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    useApproximateCount: bool
    A value indicating whether to use database table statistics for approximate counting.
    maxPageSize: int?
    The maximum allowed page size.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of property names permitted for filtering and sorting.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list.

    Type parameters: T: The entity type.; TResult: The projected result type.

  • methodToPagedListAsync<T>
    public static Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, FilterParameters filter, SortParameters sortBy, PaginationParameters parameters, bool countTotal = true, bool useApproximateCount = false, int? maxPageSize = null, IEnumerable<string>? allowedProperties = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Applies dynamic filtering, sorting, and offset pagination in a single operation.

    source: this IQueryable<T>
    The queryable source to filter, sort, and paginate.
    filter: FilterParameters
    The dynamic filter parameters.
    sortBy: SortParameters
    The dynamic sort parameters.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    useApproximateCount: bool
    A value indicating whether to use database table statistics for approximate counting.
    maxPageSize: int?
    The maximum allowed page size.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of property names permitted for filtering and sorting.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The entity type.

  • methodToPagedListAsync<T>
    public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = null, bool useApproximateCount = false, IPaginationOptions? options = null, CancellationToken cancellationToken = default)

    Materializes the query into a `PagedList<T>` using offset pagination.

    source: this IQueryable<T>
    The queryable source to paginate.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    The maximum allowed page size.
    useApproximateCount: bool
    A value indicating whether to use database table statistics for approximate counting.
    options: IPaginationOptions?
    Optional pagination configuration options.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The entity type.

  • methodToPagedListBatchedAsync<T>
    public static IAsyncEnumerable<IPagedList<T>> ToPagedListBatchedAsync<T>(this IQueryable<T> source, int batchSize = 1000, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Processes a query in offset-paginated batches, yielding each page as an `IPagedList<T>`.

    source: this IQueryable<T>
    The queryable source to paginate in batches.
    batchSize: int
    The number of items to fetch per batch.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: An `IAsyncEnumerable<T>` yielding paged lists sequentially.

    Type parameters: T: The entity type. Exceptions: ArgumentOutOfRangeException: `batchSize` is less than 1

  • methodToPagedListWithoutCountAsync<T, TResult>
    public static Task<IPagedList<TResult>> ToPagedListWithoutCountAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null, CancellationToken cancellationToken = default)

    Materializes the query into a projected `PagedList<TResult>` using count-less offset pagination (N+1 lookahead probe).

    source: this IQueryable<T>
    The queryable source to paginate.
    selector: Expression<Func<T, TResult>>
    A projection expression applied on the database server.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    maxPageSize: int?
    The maximum allowed page size.
    options: IPaginationOptions?
    Optional pagination configuration options.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list without computing total count.

    Type parameters: T: The entity type.; TResult: The projected result type.

  • methodToPagedListWithoutCountAsync<T>
    public static Task<IPagedList<T>> ToPagedListWithoutCountAsync<T>(this IQueryable<T> source, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null, CancellationToken cancellationToken = default)

    Materializes the query into a `PagedList<T>` using count-less offset pagination (N+1 lookahead probe).

    source: this IQueryable<T>
    The queryable source to paginate.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    maxPageSize: int?
    The maximum allowed page size.
    options: IPaginationOptions?
    Optional pagination configuration options.
    cancellationToken: CancellationToken
    A cancellation token to observe while waiting for the task to complete.

    Returns: A task representing the asynchronous operation. The task result contains the paged list without computing total count.

    Type parameters: T: The entity type.

class

QueryableOptimizedExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static class QueryableOptimizedExtensions

Provides advanced, optimized extension methods for EF Core paginated results.

Members (1)

  • methodToPagedListDeferredAsync<T, TKey>
    public static async Task<IPagedList<T>> ToPagedListDeferredAsync<T, TKey>(this IQueryable<T> source, Expression<Func<T, TKey>> keySelector, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = 1000, CancellationToken cancellationToken = default, int deferredMaxPageSize = 50) where TKey : notnull

    Materializes the query into a `PagedList<T>` using the deferred join pattern.

    source: this IQueryable<T>
    The queryable to paginate.
    keySelector: Expression<Func<T, TKey>>
    An expression selecting the primary key of the entity.
    parameters: PaginationParameters
    The pagination parameters defining page and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    The maximum allowed page size.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.
    deferredMaxPageSize: int
    The threshold above which deferred pagination falls back to standard offset pagination.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The entity type.; TKey: The type of the primary key.

class

SqlServerPaginationExtensions

Assembly: EricksonLopez.Pagination.EntityFrameworkCore
public static partial class SqlServerPaginationExtensions

Provides SQL Server-specific optimization helpers for pagination.

Members (2)

  • methodGetApproximateCountAsync
    public static Task<long> GetApproximateCountAsync(DbContext dbContext, string tableName, string schemaName = "", CancellationToken cancellationToken = default)

    Retrieves the approximate total count of rows in a SQL Server table using partition statistics.

    dbContext: DbContext
    The EF Core database context.
    tableName: string
    The name of the table in SQL Server.
    schemaName: string
    The schema name containing the table. Defaults to `dbo`.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the approximate row count.

    Exceptions: ArgumentNullException: `dbContext` is `null`; ArgumentException: `tableName` or `schemaName` is invalid

  • methodGetSqlServerApproximateCountAsync
    public static async Task<long> GetSqlServerApproximateCountAsync(this DbContext dbContext, string tableName, string schemaName = "", CancellationToken cancellationToken = default)

    Retrieves the approximate total count of rows in a SQL Server table using partition statistics.

    dbContext: this DbContext
    The EF Core database context.
    tableName: string
    The name of the table in SQL Server.
    schemaName: string
    The schema name containing the table.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the approximate row count.

    Exceptions: ArgumentNullException: `dbContext` is `null`; ArgumentException: `tableName` or `schemaName` is invalid

EricksonLopez.Pagination.Grpc#

1
class

PaginationGrpcExtensions

Assembly: EricksonLopez.Pagination.Grpc
public static class PaginationGrpcExtensions

Provides extension methods for converting between gRPC protobuf messages and pagination abstractions.

Members (10)

  • methodToMessage
    public static CursorPagedListMetadataMessage ToMessage(this ICursorPagedList pagedList)

    Converts an `ICursorPagedList` to a `CursorPagedListMetadataMessage`.

    pagedList: this ICursorPagedList
    The cursor paged list metadata source.

    Returns: The gRPC metadata message.

    Exceptions: ArgumentNullException: `pagedList` is `null`

  • methodToMessage
    public static PagedListMetadataMessage ToMessage(this IPagedList pagedList)

    Converts an `IPagedList` to a `PagedListMetadataMessage`.

    pagedList: this IPagedList
    The paged list metadata source.

    Returns: The gRPC metadata message.

    Exceptions: ArgumentNullException: `pagedList` is `null`

  • methodToMessage<T>
    public static CursorPagedListMetadataMessage ToMessage<T>(this ICursorPagedList<T> pagedList)

    Converts a strongly typed `ICursorPagedList<T>` to a `CursorPagedListMetadataMessage`.

    pagedList: this ICursorPagedList<T>
    The cursor paged list metadata source.

    Returns: The gRPC metadata message.

    Type parameters: T: The type of elements in the list. Exceptions: ArgumentNullException: `pagedList` is `null`

  • methodToMessage<T>
    public static PagedListMetadataMessage ToMessage<T>(this IPagedList<T> pagedList)

    Converts a strongly typed `IPagedList<T>` to a `PagedListMetadataMessage`.

    pagedList: this IPagedList<T>
    The paged list metadata source.

    Returns: The gRPC metadata message.

    Type parameters: T: The type of elements in the list. Exceptions: ArgumentNullException: `pagedList` is `null`

  • methodToMessage<TSource, TResponse>
    public static TResponse ToMessage<TSource, TResponse>(this ICursorPagedList<TSource> pagedList, TResponse response, Action<TResponse, CursorPagedListMetadataMessage> configureMetadata) where TResponse : class, Google.Protobuf.IMessage

    Maps cursor pagination metadata onto a strongly typed gRPC response message.

    pagedList: this ICursorPagedList<TSource>
    The cursor paginated list.
    response: TResponse
    The response message to populate.
    configureMetadata: Action<TResponse, CursorPagedListMetadataMessage>
    An action to assign the metadata to the response message.

    Returns: The mutated response message.

    Type parameters: TSource: The domain entity type.; TResponse: The protobuf response message type. Exceptions: ArgumentNullException: `pagedList`, `response`, or `configureMetadata` is `null`

  • methodToMessage<TSource, TResponse>
    public static TResponse ToMessage<TSource, TResponse>(this IPagedList<TSource> pagedList, TResponse response, Action<TResponse, PagedListMetadataMessage> configureMetadata) where TResponse : class, Google.Protobuf.IMessage

    Maps pagination metadata onto a strongly typed gRPC response message.

    pagedList: this IPagedList<TSource>
    The paginated list.
    response: TResponse
    The response message to populate.
    configureMetadata: Action<TResponse, PagedListMetadataMessage>
    An action to assign the metadata to the response message.

    Returns: The mutated response message.

    Type parameters: TSource: The domain entity type.; TResponse: The protobuf response message type. Exceptions: ArgumentNullException: `pagedList`, `response`, or `configureMetadata` is `null`

  • methodToParameters
    public static CursorPaginationParameters ToParameters(this CursorPaginationParametersMessage? message, IPaginationOptions? options = null)

    Converts a `CursorPaginationParametersMessage` to `CursorPaginationParameters`.

    message: this CursorPaginationParametersMessage?
    The gRPC message to convert.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: The equivalent `CursorPaginationParameters`.

    Exceptions: ArgumentOutOfRangeException: First or Last is negative or exceeds the maximum allowed page size; ArgumentException: First and Last are both specified

  • methodToParameters
    public static FilterParameters ToParameters(this FilterParametersMessage? message)

    Converts a `FilterParametersMessage` to `FilterParameters`.

    message: this FilterParametersMessage?
    The gRPC message to convert.

    Returns: The equivalent `FilterParameters`.

    Exceptions: ArgumentException: `message` contains a filter value exceeding the maximum allowed length

  • methodToParameters
    public static PaginationParameters ToParameters(this PaginationParametersMessage? message, IPaginationOptions? options = null)

    Converts a `PaginationParametersMessage` to `PaginationParameters`.

    message: this PaginationParametersMessage?
    The gRPC message to convert.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: The equivalent `PaginationParameters`.

    Exceptions: ArgumentOutOfRangeException: `message` specifies a page size exceeding the maximum allowed limit

  • methodToParameters
    public static SortParameters ToParameters(this SortParametersMessage? message)

    Converts a `SortParametersMessage` to `SortParameters`.

    message: this SortParametersMessage?
    The gRPC message to convert.

    Returns: The equivalent `SortParameters`.

EricksonLopez.Pagination.LinqToDB#

3
class

KeysetBuilder<T>

Assembly: EricksonLopez.Pagination.LinqToDB
public sealed class KeysetBuilder<T>

Provides a fluent builder for constructing multi-column keyset pagination queries.

Remarks:

Type parameters: T: The entity type.

Members (11)

  • methodAscending
    public KeysetBuilder<T> Ascending(string propertyName, IEnumerable<string>? allowedProperties = null)

    Adds a column to the keyset in ascending order using a property name.

    propertyName: string
    The name of the property to sort by.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of permitted property names.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Exceptions: ArgumentException: `propertyName` is invalid or not found on type `T`; InvalidOperationException: The resolved property is a nullable type

  • methodAscending<TProp>
    public KeysetBuilder<T> Ascending<TProp>(Expression<Func<T, TProp>> selector)

    Adds a column to the keyset in ascending order.

    selector: Expression<Func<T, TProp>>
    An expression specifying the property to sort by.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Type parameters: TProp: The property type to sort by. Exceptions: ArgumentNullException: `selector` is `null`; InvalidOperationException: `TProp` is a nullable type

  • methodDescending
    public KeysetBuilder<T> Descending(string propertyName, IEnumerable<string>? allowedProperties = null)

    Adds a column to the keyset in descending order using a property name.

    propertyName: string
    The name of the property to sort by.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of permitted property names.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Exceptions: ArgumentException: `propertyName` is invalid or not found on type `T`; InvalidOperationException: The resolved property is a nullable type

  • methodDescending<TProp>
    public KeysetBuilder<T> Descending<TProp>(Expression<Func<T, TProp>> selector)

    Adds a column to the keyset in descending order.

    selector: Expression<Func<T, TProp>>
    An expression specifying the property to sort by.

    Returns: A new `KeysetBuilder<T>` instance containing the added column.

    Type parameters: TProp: The property type to sort by. Exceptions: ArgumentNullException: `selector` is `null`; InvalidOperationException: `TProp` is a nullable type

  • methodGetKeysetSchemaFingerprint
    public string GetKeysetSchemaFingerprint()

    Computes a deterministic fingerprint for the keyset schema based on column types and sort directions.

    Returns: An 8-character uppercase hexadecimal string uniquely identifying the keyset schema.

  • methodSortBy
    public KeysetBuilder<T> SortBy(SortParameters parameters, IEnumerable<string>? allowedProperties = null)

    Applies dynamic sorting parameters to the keyset builder.

    parameters: SortParameters
    The structured sort parameters.
    allowedProperties: IEnumerable<string>?
    An optional whitelist of permitted property names.

    Returns: A new `KeysetBuilder<T>` instance containing the parsed sort columns.

    Exceptions: ArgumentException: A specified property is invalid or not found on type `T`; InvalidOperationException: A resolved property is a nullable type

  • methodToCursorPagedListAsync
    public async Task<ICursorPagedList<T>> ToCursorPagedListAsync(ICursorPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the query into a `CursorPagedList<T>` using keyset pagination.

    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor paged list.

    Exceptions: InvalidOperationException: No keyset columns have been configured

  • methodToCursorPagedListAsync<TResult>
    public async Task<ICursorPagedList<TResult>> ToCursorPagedListAsync<TResult>(Expression<Func<T, TResult>> selector, ICursorPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the query into a projected `CursorPagedList<TResult>` using keyset pagination.

    selector: Expression<Func<T, TResult>>
    A server-side projection expression from `T` to `TResult`.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the projected cursor paged list.

    Type parameters: TResult: The projected result type. Exceptions: ArgumentNullException: `selector` is `null`; InvalidOperationException: No keyset columns have been configured, or more than 16 columns are configured

  • methodToPagedAsyncEnumerable
    public IAsyncEnumerable<T> ToPagedAsyncEnumerable()

    Returns an `IAsyncEnumerable<T>` that asynchronously streams entities for the requested keyset page.

    Returns: An `IAsyncEnumerable<T>` yielding entities sequentially.

    Exceptions: InvalidOperationException: No keyset columns have been configured, or backward pagination is requested

  • methodToStreamingAsyncEnumerable
    public async IAsyncEnumerable<T> ToStreamingAsyncEnumerable(int chunkSize = 1000, CancellationToken cancellationToken = default)

    Streams all records matching the query sequentially by automatically paginating through keyset chunks.

    chunkSize: int
    The number of items to retrieve per database chunk.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: An async stream yielding entities sequentially across all chunks.

    Exceptions: InvalidOperationException: No keyset columns have been configured, or backward pagination is requested

  • methodWithTenant
    public KeysetBuilder<T> WithTenant(string tenantId)

    Binds the keyset pagination query to a specific tenant identifier. The tenant identifier is included in the keyset schema fingerprint to ensure cursors issued for one tenant cannot be used to paginate another tenant's data.

    tenantId: string
    The tenant identifier.

    Returns: A new `KeysetBuilder<T>` instance scoped to the specified tenant.

    Exceptions: ArgumentException: `tenantId` is null or whitespace

class

QueryableCursorProjectionExtensions

Assembly: EricksonLopez.Pagination.LinqToDB
public static class QueryableCursorProjectionExtensions

Provides extension methods for LinqToDB `IQueryable<T>` to create cursor-paginated and projected results.

Members (1)

  • methodToCursorPagedListAsync<T, TResult, TKey>
    public static async Task<ICursorPagedList<TResult>> ToCursorPagedListAsync<T, TResult, TKey>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, Expression<Func<T, TKey>> keySelector, Func<TResult, TKey> resultKeySelector, CursorPaginationParameters parameters, SortDirection direction = SortDirection.Ascending, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Materializes the query into a projected `ICursorPagedList<TResult>` using keyset pagination.

    source: this IQueryable<T>
    The queryable source.
    selector: Expression<Func<T, TResult>>
    A server-side projection expression from `T` to `TResult`.
    keySelector: Expression<Func<T, TKey>>
    An expression specifying the cursor column on `T`.
    resultKeySelector: Func<TResult, TKey>
    A delegate extracting the cursor key from a projected `TResult` item.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    direction: SortDirection
    The sort direction for the keyset column.
    defaultPageSize: int
    The fallback page size when none is specified.
    maxPageSize: int?
    An optional maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: A task representing the asynchronous operation. The task result contains the cursor paged list.

    Type parameters: T: The entity type stored in the database.; TResult: The projected result type.; TKey: The type of the cursor key.

class

QueryableLinqToDBExtensions

Assembly: EricksonLopez.Pagination.LinqToDB
public static class QueryableLinqToDBExtensions

Provides extension methods for LinqToDB `IQueryable<T>` to create paginated results.

Members (5)

  • methodKeyset<T>
    public static KeysetBuilder<T> Keyset<T>(this IQueryable<T> source, CursorPaginationParameters parameters, int defaultPageSize = 10, ICursorEncoder? cursorEncoder = null, bool acceptLegacyCursors = true)

    Initializes a fluent builder for multi-column keyset pagination.

    source: this IQueryable<T>
    The queryable source.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    defaultPageSize: int
    The fallback page size when none is specified.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    acceptLegacyCursors: bool
    A value indicating whether to accept legacy cursor formats.

    Returns: A new `KeysetBuilder<T>` instance.

    Type parameters: T: The entity type.

  • methodToPagedListAsync<T, TResult>
    public static async Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Materializes the query into a projected `PagedList<TResult>` using offset pagination.

    source: this IQueryable<T>
    The queryable source.
    selector: Expression<Func<T, TResult>>
    The projection expression.
    parameters: PaginationParameters
    The pagination parameters.
    countTotal: bool
    A value indicating whether to execute a count query for the total number of items.
    maxPageSize: int?
    An optional maximum allowed page size.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list.

    Type parameters: T: The source entity type.; TResult: The projected result type.

  • methodToPagedListAsync<T>
    public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = null, IPaginationOptions? options = null, CancellationToken cancellationToken = default)

    Materializes the query into a `PagedList<T>` using offset pagination.

    source: this IQueryable<T>
    The queryable source.
    parameters: PaginationParameters
    The pagination parameters.
    countTotal: bool
    A value indicating whether to execute a count query for the total number of items.
    maxPageSize: int?
    An optional maximum allowed page size.
    options: IPaginationOptions?
    Optional pagination configuration options.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The entity type.

  • methodToPagedListWithoutCountAsync<T, TResult>
    public static Task<IPagedList<TResult>> ToPagedListWithoutCountAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, int? maxPageSize = null, CancellationToken cancellationToken = default, IPaginationOptions? options = null)

    Materializes the query into a projected `PagedList<TResult>` using count-less offset pagination (N+1 lookahead probe).

    source: this IQueryable<T>
    The queryable source.
    selector: Expression<Func<T, TResult>>
    The projection expression.
    parameters: PaginationParameters
    The pagination parameters.
    maxPageSize: int?
    An optional maximum allowed page size.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.
    options: IPaginationOptions?
    Optional pagination configuration options.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list without computing total count.

    Type parameters: T: The source entity type.; TResult: The projected result type.

  • methodToPagedListWithoutCountAsync<T>
    public static Task<IPagedList<T>> ToPagedListWithoutCountAsync<T>(this IQueryable<T> source, PaginationParameters parameters, int? maxPageSize = null, IPaginationOptions? options = null, CancellationToken cancellationToken = default)

    Materializes the query into a `PagedList<T>` using count-less offset pagination (N+1 lookahead probe).

    source: this IQueryable<T>
    The queryable source.
    parameters: PaginationParameters
    The pagination parameters.
    maxPageSize: int?
    An optional maximum allowed page size.
    options: IPaginationOptions?
    Optional pagination configuration options.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the paged list without computing total count.

    Type parameters: T: The entity type.

EricksonLopez.Pagination.MongoDB#

7
class

DefaultMongoCursorDecoderRegistry

Assembly: EricksonLopez.Pagination.MongoDB
public static class DefaultMongoCursorDecoderRegistry

Provides a default cursor decoder registry for MongoDB with support for `ObjectId` and common scalar types.

Members (2)

  • methodGetEffectiveRegistry
    public static ICursorDecoderRegistry GetEffectiveRegistry(ICursorDecoderRegistry? userRegistry)

    Returns the provided registry if not `null`; otherwise returns the shared `Instance`.

    userRegistry: ICursorDecoderRegistry?
    An optional user-supplied decoder registry.

    Returns: The effective decoder registry to use for MongoDB cursor operations.

  • propertyInstance
    public static ICursorDecoderRegistry Instance { get; }

    Gets the shared singleton instance of the default MongoDB cursor decoder registry.

class

FindFluentPaginationExtensions

Assembly: EricksonLopez.Pagination.MongoDB
public static class FindFluentPaginationExtensions

Provides extension methods for MongoDB `IFindFluent<TDocument, TProjection>` to execute paginated queries.

Members (2)

  • methodToCursorPagedListAsync<TDocument, TKey>
    public static async Task<ICursorPagedList<TDocument>> ToCursorPagedListAsync<TDocument, TKey>(this IFindFluent<TDocument, TDocument> find, Expression<Func<TDocument, TKey>> keySelector, CursorPaginationParameters parameters, EricksonLopez.Pagination.Abstractions.SortDirection direction = EricksonLopez.Pagination.Abstractions.SortDirection.Ascending, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorPagedListFactory? factory = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Materializes the find operation into an `ICursorPagedList<TDocument>` using cursor pagination.

    find: this IFindFluent<TDocument, TDocument>
    The fluent find operation.
    keySelector: Expression<Func<TDocument, TKey>>
    An expression specifying the cursor column on `TDocument`.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    direction: EricksonLopez.Pagination.Abstractions.SortDirection
    The sort direction for the cursor column.
    defaultPageSize: int
    The fallback page size when none is specified.
    maxPageSize: int?
    An optional maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    decoderRegistry: ICursorDecoderRegistry?
    An optional cursor decoder registry.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor paged list.

    Type parameters: TDocument: The document type.; TKey: The cursor key type.

  • methodToPagedListAsync<TDocument, TProjection>
    public static async Task<IPagedList<TProjection>> ToPagedListAsync<TDocument, TProjection>(this IFindFluent<TDocument, TProjection> find, PaginationParameters parameters, bool countTotal = true, int defaultPageSize = 10, int? maxPageSize = 1000, IPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the find operation into an `IPagedList<TProjection>` using offset pagination.

    find: this IFindFluent<TDocument, TProjection>
    The fluent find operation.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    defaultPageSize: int
    The fallback page size when none is specified.
    maxPageSize: int?
    An optional maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: TDocument: The document type.; TProjection: The projected result or document type.

class

MongoAsyncEnumerableExtensions

Assembly: EricksonLopez.Pagination.MongoDB
public static class MongoAsyncEnumerableExtensions

Provides extension methods for MongoDB `IQueryable<T>` to stream paginated results asynchronously.

Members (1)

  • methodToPagedAsyncEnumerable<T>
    public static IAsyncEnumerable<T> ToPagedAsyncEnumerable<T>(this IQueryable<T> source, PaginationParameters parameters, int? maxPageSize = 1000)

    Returns an `IAsyncEnumerable<T>` that asynchronously streams entities for the requested page.

    source: this IQueryable<T>
    The queryable source to paginate and stream.
    parameters: PaginationParameters
    The pagination parameters.
    maxPageSize: int?
    An optional maximum allowed page size.

    Returns: An `IAsyncEnumerable<T>` yielding items sequentially.

    Type parameters: T: The entity type.

class

MongoCursorPaginationExtensions

Assembly: EricksonLopez.Pagination.MongoDB
public static class MongoCursorPaginationExtensions

Provides extension methods for MongoDB `IQueryable<T>` to create cursor-paginated results.

Members (2)

  • methodToCursorPagedListAsync<T, TKey>
    public static async Task<ICursorPagedList<T>> ToCursorPagedListAsync<T, TKey>(this IQueryable<T> source, Expression<Func<T, TKey>> keySelector, CursorPaginationParameters parameters, EricksonLopez.Pagination.Abstractions.SortDirection direction = EricksonLopez.Pagination.Abstractions.SortDirection.Ascending, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorPagedListFactory? factory = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Materializes the query into an `ICursorPagedList<T>` using cursor pagination.

    source: this IQueryable<T>
    The queryable source to paginate.
    keySelector: Expression<Func<T, TKey>>
    An expression specifying the unique, indexed cursor key.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    direction: EricksonLopez.Pagination.Abstractions.SortDirection
    The sort direction for the cursor column.
    defaultPageSize: int
    The fallback page size when none is specified.
    maxPageSize: int?
    An optional maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    decoderRegistry: ICursorDecoderRegistry?
    An optional cursor decoder registry.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor paged list.

    Type parameters: T: The entity type.; TKey: The type of the cursor key. Exceptions: InvalidOperationException: The queryable provider is not from MongoDB.Driver

  • methodToCursorPagedListAsync<TDocument, TKey, TProjection>
    public static async Task<ICursorPagedList<TProjection>> ToCursorPagedListAsync<TDocument, TKey, TProjection>(this IQueryable<TDocument> source, Expression<Func<TDocument, TKey>> keySelector, Expression<Func<TDocument, TProjection>> projection, CursorPaginationParameters parameters, EricksonLopez.Pagination.Abstractions.SortDirection direction = EricksonLopez.Pagination.Abstractions.SortDirection.Ascending, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorPagedListFactory? factory = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Materializes the query into a projected `ICursorPagedList<TProjection>` using cursor pagination.

    source: this IQueryable<TDocument>
    The queryable source to paginate.
    keySelector: Expression<Func<TDocument, TKey>>
    An expression specifying the unique, indexed cursor key.
    projection: Expression<Func<TDocument, TProjection>>
    A projection expression applied inside the database.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    direction: EricksonLopez.Pagination.Abstractions.SortDirection
    The sort direction for the cursor column.
    defaultPageSize: int
    The fallback page size when none is specified.
    maxPageSize: int?
    An optional maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    decoderRegistry: ICursorDecoderRegistry?
    An optional cursor decoder registry.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the projected cursor paged list.

    Type parameters: TDocument: The document type.; TKey: The type of the cursor key.; TProjection: The projected result type.

class

MongoObjectIdPaginationExtensions

Assembly: EricksonLopez.Pagination.MongoDB
public static class MongoObjectIdPaginationExtensions

Provides keyset pagination extension methods for MongoDB using `ObjectId` cursor keys.

Members (1)

  • methodToCursorPagedListAsync<TDocument>
    public static Task<ICursorPagedList<TDocument>> ToCursorPagedListAsync<TDocument>(this IMongoCollection<TDocument> collection, FilterDefinition<TDocument>? filter, Expression<Func<TDocument, ObjectId>> keySelector, CursorPaginationParameters parameters, EricksonLopez.Pagination.Abstractions.SortDirection direction = EricksonLopez.Pagination.Abstractions.SortDirection.Ascending, int defaultPageSize = 10, int? maxPageSize = null, ICursorEncoder? cursorEncoder = null, ICursorPagedListFactory? factory = null, ICursorDecoderRegistry? decoderRegistry = null, CancellationToken cancellationToken = default)

    Materializes a cursor-paginated keyset query on an `IMongoCollection<TDocument>` using an `ObjectId` key.

    collection: this IMongoCollection<TDocument>
    The Mongo collection.
    filter: FilterDefinition<TDocument>?
    An optional filter definition.
    keySelector: Expression<Func<TDocument, ObjectId>>
    An expression specifying the `ObjectId` cursor property.
    parameters: CursorPaginationParameters
    The cursor pagination parameters.
    direction: EricksonLopez.Pagination.Abstractions.SortDirection
    The sort direction for the cursor column.
    defaultPageSize: int
    The fallback page size when none is specified.
    maxPageSize: int?
    An optional maximum allowed page size.
    cursorEncoder: ICursorEncoder?
    An optional cursor encoder.
    factory: ICursorPagedListFactory?
    An optional factory used to instantiate the cursor paged list.
    decoderRegistry: ICursorDecoderRegistry?
    An optional cursor decoder registry.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the cursor paged list.

    Type parameters: TDocument: The document type. Exceptions: ArgumentNullException: `collection` or `keySelector` is `null`

class

MongoOffsetPaginationExtensions

Assembly: EricksonLopez.Pagination.MongoDB
public static class MongoOffsetPaginationExtensions

Provides extension methods for MongoDB `IQueryable<T>` to execute offset pagination queries.

Members (4)

  • methodToPagedListAsync<T, TResult>
    public static async Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = 1000, IPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the query into a projected `PagedList<TResult>` using offset pagination.

    source: this IQueryable<T>
    The queryable source to paginate.
    selector: Expression<Func<T, TResult>>
    A projection expression applied inside the database.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    An optional maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list.

    Type parameters: T: The entity type.; TResult: The projected result type.

  • methodToPagedListAsync<T, TResult>
    public static Task<IPagedList<TResult>> ToPagedListAsync<T, TResult>(this IQueryable<T> source, FilterParameters filter, SortParameters sortBy, Expression<Func<T, TResult>> selector, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = 1000, IPagedListFactory? factory = null, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.Ignore, CancellationToken cancellationToken = default)

    Applies dynamic filtering, sorting, and offset pagination with server-side projection in a single operation.

    source: this IQueryable<T>
    The queryable source to filter, sort, project, and paginate.
    filter: FilterParameters
    The dynamic filter parameters.
    sortBy: SortParameters
    The dynamic sort parameters.
    selector: Expression<Func<T, TResult>>
    A projection expression applied inside the database.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    An optional maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.
    unknownFieldBehavior: FilterUnknownFieldBehavior
    The behavior when an unrecognized field is encountered during filtering.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the projected paged list.

    Type parameters: T: The entity type.; TResult: The projected result type.

  • methodToPagedListAsync<T>
    public static Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, FilterParameters filter, SortParameters sortBy, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = 1000, IPagedListFactory? factory = null, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.Ignore, CancellationToken cancellationToken = default)

    Applies dynamic filtering, sorting, and offset pagination in a single operation.

    source: this IQueryable<T>
    The queryable source to filter, sort, and paginate.
    filter: FilterParameters
    The dynamic filter parameters.
    sortBy: SortParameters
    The dynamic sort parameters.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    An optional maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.
    unknownFieldBehavior: FilterUnknownFieldBehavior
    The behavior when an unrecognized field is encountered during filtering.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The entity type.

  • methodToPagedListAsync<T>
    public static async Task<IPagedList<T>> ToPagedListAsync<T>(this IQueryable<T> source, PaginationParameters parameters, bool countTotal = true, int? maxPageSize = 1000, IPagedListFactory? factory = null, CancellationToken cancellationToken = default)

    Materializes the query into a `PagedList<T>` using offset pagination.

    source: this IQueryable<T>
    The queryable source to paginate.
    parameters: PaginationParameters
    The pagination parameters defining page number and page size.
    countTotal: bool
    A value indicating whether to compute the total record count.
    maxPageSize: int?
    An optional maximum allowed page size.
    factory: IPagedListFactory?
    An optional factory used to instantiate the paged list.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains the paged list.

    Type parameters: T: The entity type.

class

MongoQueryableFilterExtensions

Assembly: EricksonLopez.Pagination.MongoDB
public static class MongoQueryableFilterExtensions

Provides sorting and filtering extensions for MongoDB `IQueryable<T>`.

Members (2)

  • methodApplyFilter<T>
    public static IQueryable<T> ApplyFilter<T>(this IQueryable<T> source, FilterParameters filter, int maxComplexity = 20, FilterUnknownFieldBehavior unknownFieldBehavior = FilterUnknownFieldBehavior.ThrowException)

    Applies dynamic string filtering to the queryable source.

    source: this IQueryable<T>
    The queryable source to filter.
    filter: FilterParameters
    The filter parameters.
    maxComplexity: int
    The maximum allowed clause complexity for the filter expression.
    unknownFieldBehavior: FilterUnknownFieldBehavior
    The behavior when an unrecognized field is encountered.

    Returns: The filtered `IQueryable<T>`, or the original queryable if no filter is specified.

    Type parameters: T: The entity type.

  • methodApplySort<T>
    public static IQueryable<T> ApplySort<T>(this IQueryable<T> source, SortParameters sortBy, EricksonLopez.Pagination.Abstractions.SortDirection direction = EricksonLopez.Pagination.Abstractions.SortDirection.Ascending, Expression<Func<T, object>>? defaultSort = null)

    Applies dynamic multi-column sorting to the queryable source.

    source: this IQueryable<T>
    The queryable source to sort.
    sortBy: SortParameters
    The sort parameters containing property names and directions.
    direction: EricksonLopez.Pagination.Abstractions.SortDirection
    The default sorting direction if not specified in sort parameters.
    defaultSort: Expression<Func<T, object>>?
    An optional fallback sorting expression.

    Returns: An `IQueryable<T>` with ordering applied.

    Type parameters: T: The entity type.

EricksonLopez.Pagination.OpenApi#

4
class

PaginationOpenApiOptionsExtensions

Assembly: EricksonLopez.Pagination.OpenApi
public static class PaginationOpenApiOptionsExtensions

Provides extension methods for configuring pagination support in OpenAPI.

Members (1)

  • methodAddPaginationSupport
    public static void AddPaginationSupport(this OpenApiOptions options)

    Configures OpenAPI options to include pagination, filtering, and sorting parameter descriptions.

    options: this OpenApiOptions
    The OpenAPI options to configure.
class

PaginationOperationFilter

Assembly: EricksonLopez.Pagination.OpenApi
public class PaginationOperationFilter : IOperationFilter
Implements: IOperationFilter

Provides a Swagger operation filter that enriches operations with pagination, filtering, and sorting parameter documentation.

Members (1)

  • methodApply
    public void Apply(OpenApiOperation operation, OperationFilterContext context)

    Inherits documentation from base type or interface.

    operation: OpenApiOperation
    context: OperationFilterContext
class

PaginationOperationTransformer

Assembly: EricksonLopez.Pagination.OpenApi
public class PaginationOperationTransformer : IOpenApiOperationTransformer
Implements: IOpenApiOperationTransformer

Provides an OpenAPI operation transformer that enriches operations with pagination, filtering, and sorting parameter documentation.

Members (1)

  • methodTransformAsync
    public Task TransformAsync(OpenApiOperation operation, OpenApiOperationTransformerContext context, CancellationToken cancellationToken)

    Inherits documentation from base type or interface.

    operation: OpenApiOperation
    context: OpenApiOperationTransformerContext
    cancellationToken: CancellationToken
class

PaginationSwaggerGenOptionsExtensions

Assembly: EricksonLopez.Pagination.OpenApi
public static class PaginationSwaggerGenOptionsExtensions

Provides extension methods for configuring pagination support in Swashbuckle Swagger generation.

Members (1)

  • methodAddPaginationSupport
    public static void AddPaginationSupport(this SwaggerGenOptions options)

    Configures Swashbuckle options to include pagination, filtering, and sorting parameter descriptions.

    options: this SwaggerGenOptions
    The SwaggerGen options to configure.

EricksonLopez.Pagination.Redis#

3
class

RedisCursorReplayStore

Assembly: EricksonLopez.Pagination.Redis
public sealed class RedisCursorReplayStore : ICursorReplayStore
Implements: ICursorReplayStore

Provides a distributed implementation of `ICursorReplayStore` backed by Redis using atomic SETNX operations.

Members (3)

  • constructorRedisCursorReplayStore
    public RedisCursorReplayStore(IConnectionMultiplexer connection, IOptions<RedisCursorReplayStoreOptions>? options = null)

    Initializes a new instance of the `RedisCursorReplayStore` class.

    connection: IConnectionMultiplexer
    The Redis connection multiplexer.
    options: IOptions<RedisCursorReplayStoreOptions>?
    Optional configuration options.

    Exceptions: ArgumentNullException: `connection` is `null`

  • methodTryAcquireNonce
    public bool TryAcquireNonce(string nonce, TimeSpan timeToLive)

    Attempts to acquire and record a cursor nonce.

    nonce: string
    The unique nonce string embedded within the cursor.
    timeToLive: TimeSpan
    The duration for which the nonce must be retained in the store.

    Returns: `true` if the nonce was fresh and successfully recorded; otherwise, `false` if it was previously consumed.

  • methodTryAcquireNonceAsync
    public async Task<bool> TryAcquireNonceAsync(string nonce, TimeSpan timeToLive, CancellationToken cancellationToken = default)

    Attempts to acquire and record a cursor nonce asynchronously.

    nonce: string
    The unique nonce string embedded within the cursor.
    timeToLive: TimeSpan
    The duration for which the nonce must be retained in the store.
    cancellationToken: CancellationToken
    A token that can be used to cancel the asynchronous operation.

    Returns: A task representing the asynchronous operation. The task result contains `true` if the nonce was fresh and successfully recorded; otherwise, `false` if it was previously consumed.

class

RedisCursorReplayStoreOptions

Assembly: EricksonLopez.Pagination.Redis
public sealed class RedisCursorReplayStoreOptions

Provides configuration options for `RedisCursorReplayStore`.

Members (2)

  • propertyDatabaseIndex
    public int? DatabaseIndex { get; set; }

    Gets or sets the specific Redis database index to use, or `null` to use the default database.

  • propertyKeyPrefix
    public string KeyPrefix { get; set; }

    Gets or sets the key prefix used when storing nonce keys in Redis. Default is `"pagination:replay:"`.

class

RedisPaginationServiceCollectionExtensions

Assembly: EricksonLopez.Pagination.Redis
public static class RedisPaginationServiceCollectionExtensions

Provides extension methods for setting up Redis cursor replay store in an `IServiceCollection`.

Members (2)

  • methodAddPaginationRedisReplayStore
    public static IServiceCollection AddPaginationRedisReplayStore(this IServiceCollection services, Action<RedisCursorReplayStoreOptions>? configureOptions = null)

    Registers `RedisCursorReplayStore` as the `ICursorReplayStore` implementation resolving `IConnectionMultiplexer` from DI.

    services: this IServiceCollection
    The service collection.
    configureOptions: Action<RedisCursorReplayStoreOptions>?
    Optional action to configure `RedisCursorReplayStoreOptions`.

    Returns: The modified service collection.

    Exceptions: ArgumentNullException: `services` is `null`

  • methodAddPaginationRedisReplayStore
    public static IServiceCollection AddPaginationRedisReplayStore(this IServiceCollection services, IConnectionMultiplexer connection, Action<RedisCursorReplayStoreOptions>? configureOptions = null)

    Registers `RedisCursorReplayStore` as the `ICursorReplayStore` implementation using an existing `IConnectionMultiplexer`.

    services: this IServiceCollection
    The service collection.
    connection: IConnectionMultiplexer
    The Redis connection multiplexer instance.
    configureOptions: Action<RedisCursorReplayStoreOptions>?
    Optional action to configure `RedisCursorReplayStoreOptions`.

    Returns: The modified service collection.

    Exceptions: ArgumentNullException: `services` or `connection` is `null`

EricksonLopez.Pagination.Relay#

4
record

Connection<TNode>

Assembly: EricksonLopez.Pagination.Relay
public sealed record Connection<TNode>

Represents a Relay Connection container for a paginated list of edges.

Remarks:

Type parameters: TNode: The type of the node entity.

Members (4)

  • constructorConnection
    public Connection(IReadOnlyList<Edge<TNode>> edges, PageInfo pageInfo, long? totalCount = null)

    Initializes a new instance of the `Connection<TNode>` record.

    edges: IReadOnlyList<Edge<TNode>>
    The list of edges contained in this connection slice.
    pageInfo: PageInfo
    Information to aid in pagination navigation.
    totalCount: long?
    Optional total count of items across all pages.

    Exceptions: ArgumentNullException: `edges` or `pageInfo` is `null`

  • propertyEdges
    public IReadOnlyList<Edge<TNode>> Edges { get; init; }

    Gets the list of edges in this connection slice.

  • propertyPageInfo
    public PageInfo PageInfo { get; init; }

    Gets information about pagination in a connection.

  • propertyTotalCount
    public long? TotalCount { get; init; }

    Gets the total number of items across all pages if requested and available.

record

Edge<TNode>

Assembly: EricksonLopez.Pagination.Relay
public sealed record Edge<TNode>

Represents an edge in a GraphQL Relay connection consisting of a node and its cursor.

Remarks:

Type parameters: TNode: The type of the encapsulated node entity.

Members (3)

  • constructorEdge
    public Edge(TNode node, string cursor)

    Initializes a new instance of the `Edge<TNode>` record.

    node: TNode
    The item entity at the end of the edge.
    cursor: string
    A cursor token for pagination seek navigation.

    Exceptions: ArgumentNullException: `cursor` is `null`

  • propertyCursor
    public string Cursor { get; init; }

    Gets a cursor for use in pagination.

  • propertyNode
    public TNode Node { get; init; }

    Gets the item entity at the end of the edge.

record

PageInfo

Assembly: EricksonLopez.Pagination.Relay
public sealed record PageInfo

Represents pagination information according to the GraphQL Relay Cursor Connections specification.

Members (4)

  • propertyEndCursor
    public string? EndCursor { get; init; }

    Gets the opaque cursor pointing to the last edge in the list, or `null` if empty.

  • propertyHasNextPage
    public bool HasNextPage { get; init; }

    Gets a value indicating whether more edges exist after the current page.

  • propertyHasPreviousPage
    public bool HasPreviousPage { get; init; }

    Gets a value indicating whether edges exist prior to the current page.

  • propertyStartCursor
    public string? StartCursor { get; init; }

    Gets the opaque cursor pointing to the first edge in the list, or `null` if empty.

class

RelayPaginationExtensions

Assembly: EricksonLopez.Pagination.Relay
public static class RelayPaginationExtensions

Provides extension methods for converting pagination result types to GraphQL Relay Connection structures.

Members (3)

  • methodToRelayConnection<T>
    public static Connection<T> ToRelayConnection<T>(this ICursorPagedList<T> list, Func<T, string> cursorSelector)

    Converts an `ICursorPagedList<T>` into a GraphQL Relay `Connection<T>`.

    list: this ICursorPagedList<T>
    The cursor paged list.
    cursorSelector: Func<T, string>
    A function extracting the unique opaque cursor for each node.

    Returns: A GraphQL Relay `Connection<T>`.

    Type parameters: T: The node entity type. Exceptions: ArgumentNullException: `list` or `cursorSelector` is `null`

  • methodToRelayConnection<T>
    public static Connection<T> ToRelayConnection<T>(this IPagedList<T> list, Func<T, string> cursorSelector)

    Converts an `IPagedList<T>` (offset pagination) into a GraphQL Relay `Connection<T>`.

    list: this IPagedList<T>
    The offset paged list.
    cursorSelector: Func<T, string>
    A function generating an opaque cursor per node.

    Returns: A GraphQL Relay `Connection<T>`.

    Type parameters: T: The node entity type. Exceptions: ArgumentNullException: `list` or `cursorSelector` is `null`

  • methodToRelayConnection<TSource, TNode>
    public static Connection<TNode> ToRelayConnection<TSource, TNode>(this ICursorPagedList<TSource> list, Func<TSource, TNode> nodeSelector, Func<TSource, string> cursorSelector)

    Converts an `ICursorPagedList<TSource>` into a mapped GraphQL Relay `Connection<TNode>`.

    list: this ICursorPagedList<TSource>
    The cursor paged list.
    nodeSelector: Func<TSource, TNode>
    A mapping function from source to node.
    cursorSelector: Func<TSource, string>
    A function extracting the unique opaque cursor for each source item.

    Returns: A GraphQL Relay `Connection<TNode>`.

    Type parameters: TSource: The source entity type.; TNode: The mapped GraphQL node type. Exceptions: ArgumentNullException: `list`, `nodeSelector`, or `cursorSelector` is `null`

EricksonLopez.Pagination.Result#

2
class

PaginationErrors

Assembly: EricksonLopez.Pagination.Result
public static class PaginationErrors

Provides standard `Error` definitions for pagination failures.

Members (3)

  • fieldExpiredCursor
    public static readonly Error ExpiredCursor

    Gets an error indicating the provided pagination cursor has expired.

  • fieldInvalidCursor
    public static readonly Error InvalidCursor

    Gets an error indicating the provided pagination cursor is invalid or malformed.

  • fieldReplayedCursor
    public static readonly Error ReplayedCursor

    Gets an error indicating the provided pagination cursor has already been used (replayed).

class

PaginationResultExtensions

Assembly: EricksonLopez.Pagination.Result
public static class PaginationResultExtensions

Provides extension methods for executing pagination queries and mapping exceptions to `Result<T>`.

Members (1)

  • methodExecuteResultAsync<TList>
    public static async Task<Result<TList>> ExecuteResultAsync<TList>(Func<Task<TList>> paginationQuery)

    Executes a pagination query safely, catching cursor-related exceptions and returning a `Result<T>`.

    paginationQuery: Func<Task<TList>>
    The asynchronous pagination query to execute.

    Returns: A task representing the asynchronous operation. The task result contains a result containing the paged list or the specific pagination error.

    Type parameters: TList: The type of the paged list (e.g., `IPagedList<T>`, `ICursorPagedList<T>`). Exceptions: ArgumentNullException: `paginationQuery` is `null`

EricksonLopez.Pagination.SourceGenerators#

2
class

CursorDecoderGenerator

Assembly: EricksonLopez.Pagination.SourceGenerators
public class CursorDecoderGenerator : IIncrementalGenerator
Implements: IIncrementalGenerator

Generates AOT-compatible cursor decoding registries by analyzing cursor pagination invocations.

Members (1)

  • methodInitialize
    public void Initialize(IncrementalGeneratorInitializationContext context)

    Initializes the incremental source generator.

    context: IncrementalGeneratorInitializationContext
    The context used to register syntax providers and output source files.
class

FilterProviderGenerator

Assembly: EricksonLopez.Pagination.SourceGenerators
public class FilterProviderGenerator : IIncrementalGenerator
Implements: IIncrementalGenerator

Generates strongly typed filter provider implementations for classes decorated with `[GenerateFilterProvider]`.

Members (1)

  • methodInitialize
    public void Initialize(IncrementalGeneratorInitializationContext context)

    Initializes the incremental source generator.

    context: IncrementalGeneratorInitializationContext
    The context used to register syntax providers and output source files.

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.