querybuilder
querybuilder copied to clipboard
Where with bool or bool? is compiled as "true" or "false" rather than "0" or "1"
Repro Go here: https://sqlkata.com/playground/sqlserver Paste this:
bool? lol = true;
bool lol2 = true;
var query = new Query("Users").Where("lol", lol).Where("lol2", lol2);
SQL Server doesn't support true/false, only 0 or 1
Hmm, I believe maybe we're suppose to use WhereTrue
or WhereFalse
... Not 100% clear though. Could do with an example on the Where page of docs.
I swear I've had this working before though... Could you confirm if it's a bug or not?
A workaround is to do a sneaky Convert.ToInt16(lol)
in there, but this is a bit of a nasty regression if that's what it is. Could bite a lot of people.
Maybe there could be a .WhereBooleanIs(true/false)
extension method?
I think this was solved by #510 check https://sqlkata.com/release/v2.3.8#whereboolean-is-now-identical-to-wheretrue-and-wherefalse So it can be closed now