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
Fields
Default
Default limit when no size is supplied.
public const int Default = 50
Field Value
Max
Default server cap.
public const int Max = 100
Field Value
MaxApplied
Largest limit for which over-fetching one additional row cannot overflow.
public const int MaxApplied = 2147483646
Field Value
Properties
Applied
The positive applied limit, no greater than Requested or MaxApplied.
public int Applied { get; }
Property Value
Requested
The requested limit, or the configured default when absent.
public int Requested { get; }
Property Value
WasCapped
Whether the server capped the requested size.
public bool WasCapped { get; }
Property Value
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
Returns
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
requestedint?maxintfieldNamestringpolicyPageSizeLimitPolicydefaultSizeint