markrendle / Simple.Data

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

OrderBy can be used to order by two or more columns #272

Closed hmobius closed 11 years ago

hmobius commented 11 years ago

We should use ThenBy() to state a second column but it appears to be able to use OrderBy to do the same in one instance.

I'd expect an ArgumentException to be called in the first two cases and then perhaps an InvalidOperationException to be thrown in the third?

// Throws UnresolvableObjectException - Column not found
db.Albums.All().OrderByArtistIdAndTitle();     
// Throws NullReferenceException
db.Albums.All().OrderBy(db.Albums.ArtistId, db.Albums.Title);              
// Runs All.OrderBy(ArtistId, Title)
db.Albums.All().OrderBy(db.Albums.ArtistId).OrderBy(db.Albums.Title);             
markrendle commented 11 years ago

Can't fix first case. Second case now actually works.