Returns a Set containing the same elements as the source Set with the sort order defined by the specified OQL order clause.
this keyword.
A Set that has a default sort order defined by the specified OQL order clause and contains the same elements as the source Set.
The order direction ("ascending" or "descending") have to be defined for each of the specified OQL expressions in the orderBy parameter.
| Exception Type | Condition |
|---|---|
| OqlParserException | orderBy does not denote a valid OQL order clause. |
| SqlDomException | orderBy is not applicable to the element type of the source Set. or orderBy can not be translated to the target SQL language. |
| SchemaException | orderBy contains expressions or features that cannot be translated with the given DataDomainSchema. |
For example there is a DataDomain instance named
GenomeDataDomain, and the following persistent class:
public abstract class Employee : Persistent
{
public abstract int EmployeeID { get; }
public abstract string LastName { get; set; }
public abstract string FirstName { get; set; }
public abstract string Title { get; set; }
public abstract string TitleOfCourtesy { get; set; }
public abstract DateTime BirthDate { get; set; }
public abstract DateTime HireDate { get; set; }
public abstract string Address { get; set; }
public abstract string City { get; set; }
public abstract string Region { get; set; }
public abstract string PostalCode { get; set; }
public abstract string Country { get; set; }
public abstract string HomePhone { get; set; }
public abstract string Extension { get; set; }
public abstract byte[] Photo { get; set; }
public abstract string Notes { get; set; }
public abstract string PhotoPath { get; set; }
public abstract Employee ReportsTo { get; set; }
…
}
...
// Ascending
Set employees = GenomeDataDomain.Extent(typeof(Employee)).OrderBy("LastName ascending");
...
or
...
// Descending
Set employees = GenomeDataDomain.Extent(typeof(Employee)).OrderBy("LastName descending");
...
...
Set employees = GenomeDataDomain.Extent(typeof(Employee)).OrderBy("LastName ascending, Title descending");
...
...
Set employees = GenomeDataDomain.Extent(typeof(Employee)).OrderBy("ReportsTo.LastName ascending");
...
Namespace: TechTalk.Genome
Assembly: TechTalk.Genome (in TechTalk.Genome.dll)
Version: 4.2.4.4
Editions: Professional, Evaluation, Express