- 修复 Expression OrElse 两侧括号丢失的 bug;

- 修复 Expression DateTime 类型 CompareTo 在 MySql/SqlServer 下的 bug;
This commit is contained in:
28810
2019-04-23 18:54:55 +08:00
parent 9dd85f33f9
commit b16218d779
11 changed files with 280 additions and 16 deletions

View File

@ -771,10 +771,11 @@ namespace FreeSql.Internal {
if (string.IsNullOrEmpty(other99Exp) == false) return other99Exp;
return "";
}
if (expBinary.NodeType == ExpressionType.Coalesce) {
return _common.IsNull(
ExpressionLambdaToSql(expBinary.Left, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style),
ExpressionLambdaToSql(expBinary.Right, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style));
switch (expBinary.NodeType) {
case ExpressionType.Coalesce:
return _common.IsNull(ExpressionLambdaToSql(expBinary.Left, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style), ExpressionLambdaToSql(expBinary.Right, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style));
case ExpressionType.OrElse:
return $"({ExpressionLambdaToSql(expBinary.Left, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)} OR {ExpressionLambdaToSql(expBinary.Right, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style)})";
}
if (dicExpressionOperator.TryGetValue(expBinary.NodeType, out var tryoper) == false) return "";
var left = ExpressionLambdaToSql(expBinary.Left, _tables, _selectColumnMap, getSelectGroupingMapString, tbtype, isQuoteName, isDisableDiyParse, style);