I would do:
using(var context = new DomainEntities())
{
var result = context.Users.OrderBy(u => u.LastName == null)
.ThenBy(u => u.LastName)
.ThenBy(u => u.FirstName == null)
.ThenBy(u => u.FirstName);
}
...which should produce reasonable SQL.
EDIT: explanation (taken from Craig's comment):
Because false
sorts before true
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…