Sorting

SQL allows sorting data by one or more columns in ascending or descending order. To do that, you either add a Query.AscendingOrder or a Query.DescendingOrder object to the Orderings collection of the Query object. You submit the field names as parameters by which the data set shall be sorted. NDO translates this field name into a database column name:

Query q = pm.NewQuery(typeof(Employee), ...);

// Optionally you can use the QueryHelper

q.Orderings.Add(new DescendingOrder("name"));

IList l = q.Execute();