I know that by implementing IComparable on a class, like…
public class Person : IComparable<Person>
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int CompareTo(Person other)
{
var val = LastName.CompareTo(other.LastName);
return val == 0 ? FirstName.CompareTo(other.FirstName) : val;
}
}
…allows me to call
IEnumerable.OrderBy(x => x.Person);
…instead of
IEnumerable.OrderBy(x => x.Person.LastName)
.ThenBy(x => x.Person.FirstName);
How would I be able to do the same with an IQueryable.OrderBy in LINQ To SQL on a Person Entity?