I have a requirement for a query ordered by an int field, called priority. This field could be null, equal or bigger than 0.
I would like to order first, by priority ascending excluding 0 (From 1 to X), and after by CreatedOn if priority is null or 0.
OrderExpression order1 = new OrderExpression();
order1.AttributeName = "priority";
order1.OrderType = OrderType.Ascending;
OrderExpression order2 = new OrderExpression();
order2.AttributeName = "createdon";
order2.OrderType = OrderType.Ascending;
query.Orders = new OrderExpression[] { order1, order2 };
With this ordering, the first elements have priority equal to 0.
Actually, I have to do two queries and after join the DataSet, but I was wondering if this can be accomplish with one query, because I could have a next requirement of adding paging to the grids where this info is bind.