markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

ThenBy(xyz) should throw ArgumentException if xyz is not valid column reference #279

Closed hmobius closed 11 years ago

hmobius commented 11 years ago

If I call ThenBy(xyz) where xyz is not a valid single columnReference, as below, a NullReferenceException is thrown.

db.Albums.All().OrderBy(db.Albums.AlbumId).ThenBy();
db.Albums.All().OrderBy(db.Albums.AlbumId).ThenBy(1);
db.Albums.All().OrderBy(db.Albums.AlbumId).ThenBy(db.Albums.GenreId == 1);
db.Albums.All().OrderBy(db.Albums.AlbumId).ThenBy(db.Albums.ArtistId, db.Albums.Title);

I would expect it to throw an ArgumentException instead.