I'd like to sort my result like this:
- First I want all rows/objects where a column/property is not null, then all where the colmn/property is null.
- Then I want to sort by another column/property.
How can I do this with ICriteria? Do I have to create my own Order class, or can it be done with existing code?
ICriteria criteria = Session.CreateCriteria<MyClass>()
.AddOrder(Order.Desc("NullableProperty")) // What do I do here? IProjection? Custom Order class?
.AddOrder(Order.Asc("OtherProperty"));
I'd like to have an order like this:
NullableProperty OtherProperty
---------------- -------------
1 2
8 7
5 9
NULL 1
NULL 3
NULL 8
.AddOrder(Order.Asc("NullableProperty")
after the case ordering but before OtherProperty. – Ally