Telavian
Telavian

Reputation: 3832

ServiceStack AutoQuery ordering

I am using AutoQuery which makes writing services very simple. One of my queries needs to order descending by value X and then ascending by value Y. It appears that in AutoQuery you can order everything ascending or descending but not a combination.

To get around this I added custom properties to indicate my states something like this:

    // Custom fields to determine sort order
    public bool? IsState1 { get; set; }
    public bool? IsState2 { get; set; }

This does work however I was wondering if it was possible to do this natively.

Upvotes: 1

Views: 161

Answers (1)

mythz
mythz

Reputation: 143349

AutoQuery lets you specify multiple Order By's where you can sort in reverse order by prepending a - before the field name, e.g:

?orderBy=X,-Y

Upvotes: 2

Related Questions