mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 IIF 三元表达式树解析 bool HasValue 问题;
This commit is contained in:
parent
d55ddf4cf8
commit
4549bf446c
@ -39,6 +39,9 @@ namespace FreeSql.Tests.SqlServerExpression
|
||||
[Fact]
|
||||
public void Boolean()
|
||||
{
|
||||
var s1 = select.Where(a => a.testFieldBoolNullable.HasValue).ToList();
|
||||
var s2 = select.GroupBy(a => new { IsCheck = a.testFieldBoolNullable.HasValue ? true : false }).ToList(g => g.Key);
|
||||
|
||||
var t1 = select.Where(a => a.testFieldBool == true).ToList();
|
||||
var t2 = select.Where(a => a.testFieldBool != true).ToList();
|
||||
var t3 = select.Where(a => a.testFieldBool == false).ToList();
|
||||
|
@ -691,7 +691,7 @@ namespace FreeSql.Internal
|
||||
}
|
||||
}
|
||||
}
|
||||
if (leftExp.Type.NullableTypeOrThis() == typeof(bool) && (leftExp.NodeType != ExpressionType.MemberAccess && rightExp.NodeType != ExpressionType.MemberAccess))
|
||||
if (leftExp.Type.NullableTypeOrThis() == typeof(bool) && (left.EndsWith(" IS NOT NULL") || left.EndsWith(" IS NULL") || leftExp.NodeType != ExpressionType.MemberAccess && rightExp.NodeType != ExpressionType.MemberAccess))
|
||||
{
|
||||
var leftExpCall = leftExp as MethodCallExpression;
|
||||
if (leftExpCall == null || !(leftExpCall.Method.DeclaringType == typeof(SqlExt) && leftExpCall.Method.Name == nameof(SqlExt.IsNull)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user