markrendle / Simple.Data

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

Calling First() or FirstOrDefault() with an invalid argument should throw ArgumentException #293

Closed hmobius closed 11 years ago

hmobius commented 11 years ago

If you call any of

var db = Database.Open.Albums.All().First(123);
var db = Database.Open.Albums.All().First<Album>(123);
var db = Database.Open.Albums.All().FirstOrDefault(123);
var db = Database.Open.Albums.All().FirstOrDefault<Album>(123);

A RuntimeBinderException is thrown. Suggest that an ArgumentException should be thrown in all four cases.

hmobius commented 11 years ago

Applies also to Single() and SingleOrDefault()

markrendle commented 11 years ago

Now throws InvalidOperationException