You can do this using Projections.Conditional, for sample:
ChargeOperation itemAlias = null;
var result =
session.QueryOver<ChargeOperation>(() => itemAlias)
.Where ( )
.OrderBy(Projections.Conditional(
Restrictions.Where(() => itemAlias.TypeId == 1),
Projections.Constant(3),
Projections.Conditional(
Restrictions.Where(() => itemAlias.TypeId == 2),
Projections.Constant(1),
Projections.Conditional(
Restrictions.Where(() => itemAlias.TypeId == 3),
Projections.Constant(2),
)
)
)
).Asc
.ThenBy(x => x.TypeId)
.ThenBy(x => x.CalculationAmount)
.List();
source
share