- 修复 SqlServer WithLock 子查询不生效的 bug;#1159

This commit is contained in:
2881099
2022-06-21 12:40:14 +08:00
parent 26115cfc93
commit aac99d6266
4 changed files with 292 additions and 184 deletions

View File

@ -993,6 +993,7 @@ namespace FreeSql.Internal
break;
}
object fsql = null;
Expression fsqlExpLambda = null;
Select0Provider fsqlSelect0 = null;
List<SelectTableInfo> fsqltables = null;
var fsqltable1SetAlias = false;
@ -1069,7 +1070,11 @@ namespace FreeSql.Internal
while (exp3StackOld.Any()) exp3Stack.Push(exp3StackOld.Pop());
}
}
if (fsql == null) fsql = Expression.Lambda(exp3tmp).Compile().DynamicInvoke();
if (fsql == null)
{
fsql = Expression.Lambda(exp3tmp).Compile().DynamicInvoke();
fsqlExpLambda = exp3tmp;
}
fsqlType = fsql?.GetType();
if (fsqlType == null) break;
fsqlSelect0 = fsql as Select0Provider;
@ -1134,6 +1139,10 @@ namespace FreeSql.Internal
{
args[a] = (arg3Exp as ConstantExpression)?.Value;
}
else if (arg3Exp == fsqlExpLambda)
{
args[a] = fsql;
}
else
{
var argExp = (arg3Exp as UnaryExpression)?.Operand;