How to order by column with null values last in entity framework

Posted by devlife on Stack Overflow See other posts from Stack Overflow or by devlife
Published on 2010-05-11T21:59:31Z Indexed on 2010/05/11 22:04 UTC
Read the original article Hit count: 213

Filed under:

Does anyone know how to return an ordered list of strings with null values last? I have something like this:

using(var context = new DomainEntities())
{
    var result = context.Users.OrderBy(u => u.LastName).ThenBy(u => u.FirstName);
}

My problem though is that this query returns null values before non-null values.

Any thoughts?

© Stack Overflow or respective owner

Related posts about entity-framework