Class Sort
- Namespace
- Geotab.Checkmate.ObjectModel
- Assembly
- Geotab.Checkmate.ObjectModel.dll
A generic implementation of ISort for sort fields that do not have a standardized SortField name. Being a generic implementation, there is no proper type validation for the offset field. It is recommended to use the appropriate ISort implementation instead when used for paging. For example, use SortById when sorting by "id". The recommended ISort implementations are:
public class Sort : ISort
- Inheritance
-
Sort
- Implements
- Inherited Members
Constructors
Sort(string, SortDirection?, string?, Id?)
Initializes a new instance of the Sort class.
public Sort(string sortBy, SortDirection? direction = SortDirection.Asc, string? offset = null, Id? lastId = null)
Parameters
sortBy
stringThe field to sort by.
direction
SortDirection?The sort direction.
offset
stringThe offset.
lastId
IdThe last id.
Properties
LastId
Gets or sets the lastId. Can be null but recommended to use alongside offset when sorting by a non-unique field like "name" or any DateTime field. It ensures that no records are missed at the page boundaries.
public Id? LastId { get; set; }
Property Value
- Id
The last id.
Offset
Gets or sets the offset. Used in paging to indicate where the last page left off, the value can be null for the first page then becomes the last known value of the SortBy property. The value's type must match the type of your SortBy property. A string offset may not always match your SortBy property but, when using the appropriate ISort implementation you can guarantee it will be.
public string? Offset { get; set; }
Property Value
- string
The offset.
SortBy
Gets or sets the field to sort by.
public string SortBy { get; set; }
Property Value
- string
The sort field.
SortDirection
Gets or sets the sort direction.
The default is Asc.
public SortDirection? SortDirection { get; set; }
Property Value
- SortDirection?
The sort direction.