markrendle / Simple.Data

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

Exists ignore malformed arguments and runs anyway. Should throw BadExpressionException #316

Open hmobius opened 10 years ago

hmobius commented 10 years ago

Exists() can take a SimpleExpression argument to add a filter to its query. However, when the argument is a malformed SimpleExpression, Exists seems to ignore it and run as if it had no argument at all. For example,

var testOne = db.Albums.Exists(db.Albums.GenreId); // Just column name
var testTwo = db.Albums.Exists(1);  // No column names
var testThree = db.Albums.Exists(true);   // No column names

In all three cases, I would expect a BadExpressionException to be thrown. Instead, SimpleData checks for data in the Albums data and returns true.