From d06cb08e0df7a4fbd72677b1d8e71d033800f390 Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Sat, 15 Jan 2022 17:28:59 +0800 Subject: [PATCH] Update exp to sql --- .../SqlSeverTest/SqlSeverTest/UnitTest/UQueryable.cs | 11 +++++++++++ .../ExpressionsToSql/ResolveItems/BaseResolve.cs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSeverTest/UnitTest/UQueryable.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSeverTest/UnitTest/UQueryable.cs index cfc75830a..5294b4037 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSeverTest/UnitTest/UQueryable.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSeverTest/UnitTest/UQueryable.cs @@ -96,6 +96,12 @@ namespace OrmTest }).ToSql(); UValidate.Check(x.Key, "SELECT [a] AS [a] FROM [BoolTest2] ", "Queryable"); + Db.CodeFirst.InitTables(); + var blist3= Db.Queryable().Select(it => new BoolTest3() + { + a = string.IsNullOrEmpty(it.Name) + }).ToList(); + var db = Db; db.CodeFirst.InitTables(); db.Deleteable().ExecuteCommand(); @@ -519,4 +525,9 @@ namespace OrmTest { public bool? a { get; set; } } + public class BoolTest3 + { + public bool? a { get; set; } + public string Name { get; set; } + } } diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs index 7bc091953..ee05afd98 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/ExpressionsToSql/ResolveItems/BaseResolve.cs @@ -483,7 +483,7 @@ namespace SqlSugar } } } - else if (item.Type == UtilConstants.BoolType && item is MethodCallExpression && (item as MethodCallExpression).Method.Name == "Any"&&IsSubMethod(item as MethodCallExpression)) + else if (item.Type == UtilConstants.BoolType && item is MethodCallExpression) { this.Expression = item; this.Start();