diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
index bf9f9d4e2..9890a486b 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 222b2dacb..bd7cf9858 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()
{
+ USelectTest.Init();
UnitSubToList.Init();
UnitByteArray.Init();
UnitInsertNavOneToOne.Init();
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/USelectTest.cs b/Src/Asp.Net/SqlServerTest/UnitTest/USelectTest.cs
new file mode 100644
index 000000000..72251581d
--- /dev/null
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/USelectTest.cs
@@ -0,0 +1,64 @@
+using SqlSugar;
+using System.Linq;
+
+namespace OrmTest
+{
+ public class USelectTest
+ {
+ public class SelectMenuDomain
+ {
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+ public int Pid { get; set; }
+ public string Name { get; set; }
+ }
+ public class SelectMenuResponse
+ {
+ public int Id { get; set; }
+ public int Pid { get; set; }
+ public string Name { get; set; }
+ ///
+ /// 父类名称
+ ///
+ public string PName { get; set; }
+ }
+ public static void Init()
+ {
+ var db = NewUnitTest.Db;
+ // db.Aop.OnLogExecuting = null;
+
+ db.CodeFirst.InitTables();
+ db.DbMaintenance.DropTable();
+ db.CodeFirst.InitTables();
+
+ db.Insertable(new SelectMenuDomain() { Id = 1, Name = "顶级菜单" }).ExecuteCommand();
+ db.Insertable(new SelectMenuDomain() { Id = 2, Pid = 1, Name = "子集菜单" }).ExecuteCommand();
+
+ TestAA(db);
+
+ }
+ private static void TestAA(SqlSugarClient db)
+ {
+ var test11 = db.Queryable().ToList();
+ var test1 = db.Queryable()
+ .Select(a => new SelectMenuResponse()
+ {
+ PName = SqlFunc.Subqueryable().Where(d => d.Id == a.Pid).Select(d => d.Name)
+ },
+ true)
+ .ToList();
+ if (test1.Last().PName != "顶级菜单")
+ {
+ throw new System.Exception("unit error");
+ }
+ if (test1.Last().Id != 2)
+ {
+ throw new System.Exception("unit error");
+ }
+ if (test1.Last().Name!= "子集菜单")
+ {
+ throw new System.Exception("unit error");
+ }
+ }
+ }
+}
\ No newline at end of file