Query Options
QueryOptions allows you to support pagination, set sort expression or sort direction. You can also include related entities to load into the result-set as part of your query.
Below is the list of properties QueryOption provides:
The example below shows how you can pass the QueryOptions:
var options = new QueryOptions {
SortExpression = "Name",
SortDirection = ListSortDirection.Ascending,
Includes = "Contacts"
};
var result = Database.Query<Account>(options)
.Where(a => a.Name.Contains("media"))
.ToList();