Table of Contents

Class PageSize

Namespace
Trellis
Assembly
Trellis.Core.dll

Validated requested/applied limits. Missing input uses the default; non-positive input fails; above-cap input is clamped unless rejection is explicitly selected.

public sealed record PageSize : IEquatable<PageSize>
Inheritance
PageSize
Implements
Inherited Members
Extension Methods

Constructors

PageSize(int, int)

Constructs validated limits from trusted values; invalid arguments throw.

public PageSize(int requested, int applied)

Parameters

requested int
applied int

Fields

Default

Default limit when no size is supplied.

public const int Default = 50

Field Value

int

Max

Default server cap.

public const int Max = 100

Field Value

int

MaxApplied

Largest limit for which over-fetching one additional row cannot overflow.

public const int MaxApplied = 2147483646

Field Value

int

Properties

Applied

The positive applied limit, no greater than Requested or MaxApplied.

public int Applied { get; }

Property Value

int

Requested

The requested limit, or the configured default when absent.

public int Requested { get; }

Property Value

int

WasCapped

Whether the server capped the requested size.

public bool WasCapped { get; }

Property Value

bool

Methods

FromRequested(int?, int)

Creates a size from trusted input, defaulting absence and clamping above-cap values. Throws for non-positive input. Use TryCreate at an untrusted boundary.

public static PageSize FromRequested(int? requested, int max = 100)

Parameters

requested int?
max int

Returns

PageSize

TryCreate(int?, int, string?, PageSizeLimitPolicy, int)

Parses client input using an explicit cap policy. Invalid client input returns InvalidInput; invalid server maximum, default or policy throws.

public static Result<PageSize> TryCreate(int? requested, int max = 100, string? fieldName = null, PageSizeLimitPolicy policy = PageSizeLimitPolicy.Clamp, int defaultSize = 50)

Parameters

requested int?
max int
fieldName string
policy PageSizeLimitPolicy
defaultSize int

Returns

Result<PageSize>