DynamicWhere.ex
DynamicWhere.exv2.1.5·docs

Example 4: Order — Single / Multiple Ordering

An OrderBy entry with Sort + Field + Direction feeds Order<T>.

Single order

{
  "sort": 1,
  "field": "CreatedAt",
  "direction": "Descending"
}

Multiple orders

[
  { "sort": 1, "field": "LastName", "direction": "Ascending" },
  { "sort": 2, "field": "FirstName", "direction": "Ascending" }
]

Order by a value inside a collection

Dotted paths may cross collection navigations. Because a sort needs a single comparable value per row, the collection is reduced with an aggregate — Min ascending, Max descending.

[
  { "sort": 1, "field": "Tags.Value", "direction": "Ascending" },
  { "sort": 2, "field": "OrderItems.Product.Name", "direction": "Descending" }
]

Generated as Tags.Min(Value) asc and OrderItems.Max(Product.Name) desc. See collection paths for empty-collection behaviour and limits.