From dd542d172ff227c93420028f68957a3479f489dd Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 7 Mar 2024 21:48:18 +0800 Subject: [PATCH] Update exp to sql --- .../UnitTest/UnitManyOtMany2131.cs | 52 ++++++++++++++++++- .../SqlSugar/SqlSugarForCore.nuspec | 2 +- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitManyOtMany2131.cs b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitManyOtMany2131.cs index 3aa5568cf..4524bc378 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitManyOtMany2131.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitManyOtMany2131.cs @@ -44,13 +44,61 @@ namespace OrmTest Roles = new List() { new Role() { id = 2 }, new Role() { id = 1 } } - }).Include(it=>it.Roles).ExecuteCommand(); + }).Include(it => it.Roles).ExecuteCommand(); var list1 = db.Queryable() .Includes(it => it.Roles) - .ToList(); + .ToList(); + + TestLength2(db); + TestLength3(db); + TestLength1(db); } + private static void TestLength1(SqlSugarClient db) + { + var par = "aa"; + db.Queryable() + .Where(it => it.name.ToString().Substring(1, par.Length) == "") + .ToList(); + var sql1 = db.Queryable() + .Where(it => it.name.ToString().Substring(1, par.Length) == "") + .ToSqlString(); + + if (sql1.Contains("LEN(LEN")) + { + throw new Exception("error;"); + } + } + private static void TestLength2(SqlSugarClient db) + { + var par = "aa"; + db.Queryable() + .Where(it => it.name.ToString().Substring(1, "aa".Length) == "") + .ToList(); + var sql1 = db.Queryable() + .Where(it => it.name.ToString().Substring(1, "aa".Length) == "") + .ToSqlString(); + + if (sql1.Contains("LEN(LEN")) + { + throw new Exception("error;"); + } + } + private static void TestLength3(SqlSugarClient db) + { + db.Queryable() + .Where(it => it.name.ToString().Substring(1, it.name.Length) == "") + .ToList(); + var sql1 = db.Queryable() + .Where(it => it.name.ToString().Substring(1, it.name.Length) == "") + .ToSqlString(); + + if (sql1.Contains("LEN(LEN")) + { + throw new Exception("error;"); + } + } /// /// 描述: /// 作者:synjones diff --git a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec index 14287e730..836334960 100644 --- a/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec +++ b/Src/Asp.NetCore2/SqlSugar/SqlSugarForCore.nuspec @@ -2,7 +2,7 @@ SqlSugarCore - 5.1.4.145 + 5.1.4.146-preview01 sunkaixuan 果糖大数据科技 http://www.apache.org/licenses/LICENSE-2.0.html