mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 子查询 WhereIf 可能失败的 bug;
This commit is contained in:
parent
864eca6d72
commit
43e7bdce9c
@ -689,6 +689,18 @@ namespace FreeSql.Tests.Sqlite
|
||||
.Any()
|
||||
).Any()
|
||||
).ToList();
|
||||
|
||||
sql2222 = select.Where(a =>
|
||||
select.Where(b => b.Id == a.Id &&
|
||||
select
|
||||
.Where(c => c.Id == b.Id)
|
||||
.Where(d => d.Id == a.Id)
|
||||
.Where(e => e.Id == b.Id)
|
||||
.WhereIf(!sql2222.Any(), e => e.Id > 0)
|
||||
.WhereIf(sql2222.Any(), e => e.Id >= 0)
|
||||
.Any()
|
||||
).Any()
|
||||
).ToList();
|
||||
}
|
||||
[Fact]
|
||||
public void GroupBy()
|
||||
|
@ -1066,7 +1066,9 @@ namespace FreeSql.Internal
|
||||
else
|
||||
{
|
||||
var argExp = (arg3Exp as UnaryExpression)?.Operand;
|
||||
if (argExp != null && argExp.NodeType == ExpressionType.Lambda)
|
||||
if (argExp != null)
|
||||
{
|
||||
if (argExp.NodeType == ExpressionType.Lambda)
|
||||
{
|
||||
if (fsqltable1SetAlias == false)
|
||||
{
|
||||
@ -1086,6 +1088,11 @@ namespace FreeSql.Internal
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
argExp = null;
|
||||
}
|
||||
}
|
||||
args[a] = argExp ?? Expression.Lambda(arg3Exp).Compile().DynamicInvoke();
|
||||
//if (args[a] == null) ExpressionLambdaToSql(call3Exp.Arguments[a], fsqltables, null, null, SelectTableInfoType.From, true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user