It is possible. We can use Conditional projection:
var conditionalOrderBy = Projections.Conditional
(
Restrictions.IsNull("CommonName") // or LastName, not sure from a question snippet
, Projections.Property("FirstName")
, Projections.Property("CommonName") // or LastName
);
var list = criteria.GetExecutableCriteria(session)
.AddOrder(new Order(conditionalOrderBy, true))
.List<Person>()
;
And SQL statement we get would be like:
...
ORDER BY (CASE when this_.CommonName IS NULL
THEN this_.FirstName
ELSE this_.CommonName END)
ASC