- 优化 IIF 表达式解析;

This commit is contained in:
2881099
2022-05-05 10:39:38 +08:00
parent a7b40e9a5a
commit a47b8c0e15
2 changed files with 261 additions and 1 deletions

View File

@ -759,7 +759,9 @@ namespace FreeSql.Internal
var conditionalTestOldMapType = tsc.SetMapTypeReturnOld(null);
if (condExp.Test.IsParameter())
{
var conditionalTestSql = ExpressionLambdaToSql(condExp.Test, tsc);
var condExp2 = condExp.Test;
if (condExp2.NodeType == ExpressionType.MemberAccess) condExp2 = Expression.Equal(condExp2, Expression.Constant(true));
var conditionalTestSql = ExpressionLambdaToSql(condExp2, tsc);
tsc.SetMapTypeReturnOld(conditionalTestOldMapType);
var conditionalSql = _common.IIF(conditionalTestSql, ExpressionLambdaToSql(condExp.IfTrue, tsc), ExpressionLambdaToSql(condExp.IfFalse, tsc));
tsc.SetMapTypeReturnOld(null);