markrendle / Simple.Data

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

ThenBy(named_parameter) without OrderBy throws NullReferenceException instead of InvalidOperationException #278

Closed hmobius closed 11 years ago

hmobius commented 11 years ago

If I call ThenBy() over a base command without a call to OrderBy(), I'd expect an InvalidOperationException to be thrown. This is true if I call.

db.Albums.All().ThenBy();
db.Albums.All().ThenByArtistId();

But if I call the named parameter version I get a NullReferenceException.

db.Albums.All().ThenBy(db.Albums.ArtistId);

Am guessing it should also throw an InvalidOperationException.