From 41b853d63e14ad44f0a25059c8fb76009eeebba3 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 3 Jun 2023 12:28:56 +0800 Subject: [PATCH] Add unit test --- Src/Asp.NetCore2/SqlSeverTest/Program.cs | 2 +- .../SqlSeverTest/UnitTest/UnitSubToList.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/SqlSeverTest/Program.cs b/Src/Asp.NetCore2/SqlSeverTest/Program.cs index 571653449..a6d201618 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/Program.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/Program.cs @@ -12,7 +12,7 @@ namespace OrmTest /// static void Main(string[] args) { - + UnitSubToList.Init(); //Demo Demo0_SqlSugarClient.Init(); Demo1_Queryable.Init(); diff --git a/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitSubToList.cs b/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitSubToList.cs index 4c0cc5fc1..258ea5f80 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitSubToList.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UnitTest/UnitSubToList.cs @@ -70,7 +70,17 @@ namespace OrmTest var list = query.ToList(); + var query2 = db.Queryable() + .LeftJoin((u,p)=>true) + .Where(u => u.ArticleId == 100) + .Select(u => new SysCommentOutput + { + SysUser = SqlFunc.Subqueryable().Where(user => user.Id == u.UserId).First(), + SysUsers = SqlFunc.Subqueryable().Where(user => user.Id == u.UserId).ToList() + }, true); + + var list22 = query2.ToList(); } //评论表