diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj index e2d42bbf1..84276c111 100644 --- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj +++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj @@ -97,6 +97,7 @@ + diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs index dbb7c5bd8..4ffc6bdb8 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs @@ -31,6 +31,7 @@ namespace OrmTest } public static void Init() { + UnitSub.Init(); UnitUpdateNavN3.Init(); UnitOneToOne12.Init(); UnitInsertNav3.Init(); diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UnitSub.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UnitSub.cs new file mode 100644 index 000000000..032320d89 --- /dev/null +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UnitSub.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +namespace OrmTest +{ + public class UnitSub + { + public static void Init() + { + var db = NewUnitTest.Db; + var sql=db.Queryable() + .Select(it => new + { + id= SqlFunc.Subqueryable().Sum(o => o.Id) + }).ToSql(); + if (!sql.Key.Contains("id_1")) + { + throw new Exception("unit error"); + } + } + public class SubEntity + { + [SqlSugar.SugarColumn(ColumnName ="id_1")] + public decimal Id { get; set; } + } + } +}