markrendle / Simple.Data

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

db.TableName.OrderByFieldName() works but shouldn't #269

Closed hmobius closed 11 years ago

hmobius commented 11 years ago

If I call OrderBy() directly on a table reference without a base command (All, FindAll etc), I'd expect a NullReferenceException to be thrown because there's no command to qualify. This works if I call any of the following

db.Albums.OrderBy();
db.Albums.OrderBy(db.Albums.ArtistId);
db.Albums.OrderBy(db["Albums"]["ArtistId"]);

But if I call

db.Albums.OrderByArtistId();

The albums table is returned ordered by artistId. I'd expect this last call not to run.

markrendle commented 11 years ago

Too hard to fix.