修复 Convert.ToBoolean bug

This commit is contained in:
28810
2019-03-15 09:37:27 +08:00
parent f0d8d05886
commit 63c19f8702
5 changed files with 12 additions and 13 deletions

View File

@ -274,7 +274,7 @@ namespace FreeSql.SqlServer {
Func<Expression, string> getExp = exparg => ExpressionLambdaToSql(exparg, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName);
if (exp.Object == null) {
switch (exp.Method.Name) {
case "ToBoolean": return $"({getExp(exp.Arguments[0])} not in ('0','false'))";
case "ToBoolean": return $"(cast({getExp(exp.Arguments[0])} as varchar) not in ('0','false'))";
case "ToByte": return $"cast({getExp(exp.Arguments[0])} as tinyint)";
case "ToChar": return $"substring(cast({getExp(exp.Arguments[0])} as nvarchar),1,1)";
case "ToDateTime": return $"cast({getExp(exp.Arguments[0])} as datetime)";