Struct CursorToken
Opaque cursor identifying a boundary document in a keyset-paginated query.
Carries the sort-field path, sort direction, the sort-field value at the boundary, and the
document _id (used as a tiebreaker on non-unique sort fields).
Round-trip via ToString() + Parse(string) for URL-safe storage.
public readonly struct CursorToken : IEquatable<CursorToken>
- Implements
- Inherited Members
Properties
Empty
Sentinel for "no cursor" — used as the boundary value in CursorPage<T> when there are no items.
public static CursorToken Empty { get; }
Property Value
IsEmpty
True when this token is the Empty sentinel.
public bool IsEmpty { get; }
Property Value
Methods
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
Equals(CursorToken)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(CursorToken other)
Parameters
otherCursorTokenAn object to compare with this object.
Returns
From<TEntity, TKey>(TEntity, Expression<Func<TEntity, object>>, bool)
Construct a cursor that points at entity under the given sort. Used by adapter code
that falls back to skip-based queries (e.g. arbitrary page-number jumps) and then needs to resume keyset
navigation from the boundary documents. sortBy = null creates an _id-only cursor.
public static CursorToken From<TEntity, TKey>(TEntity entity, Expression<Func<TEntity, object>> sortBy, bool ascending) where TEntity : EntityBase<TKey>
Parameters
entityTEntitysortByExpression<Func<TEntity, object>>ascendingbool
Returns
Type Parameters
TEntityTKey
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Parse(string)
Parse a cursor from its ToString() form. Throws FormatException for malformed input. An empty or null string returns Empty.
public static CursorToken Parse(string s)
Parameters
sstring
Returns
ToString()
URL-safe string form. Round-trips with Parse(string).
public override string ToString()
Returns
Operators
operator ==(CursorToken, CursorToken)
public static bool operator ==(CursorToken left, CursorToken right)
Parameters
leftCursorTokenrightCursorToken
Returns
operator !=(CursorToken, CursorToken)
public static bool operator !=(CursorToken left, CursorToken right)
Parameters
leftCursorTokenrightCursorToken