diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
index 337e206ee..b4e89eba2 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 a068d1efc..9bdecdaf5 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()
{
+ UCustom24.Init();
UCustom20.Init();
UTran2.Init();
UnitUpdateSubQuery.Init();
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom24.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom24.cs
new file mode 100644
index 000000000..ce2b2c596
--- /dev/null
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom24.cs
@@ -0,0 +1,125 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SqlSugar;
+namespace OrmTest
+{
+ public class ORdER
+ {
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true,ColumnName ="id")]
+ public int Id1 { get; set; }
+ ///
+ /// 姓名
+ ///
+ [SugarColumn(ColumnName = "Name")]
+ public string Name1 { get; set; }
+ [SugarColumn(ColumnName = "Price")]
+ public decimal Price1 { get; set; }
+ [SugarColumn(IsNullable = true,ColumnName = "CreateTime")]
+ public DateTime CreateTime1 { get; set; }
+ [SugarColumn(IsNullable = true, ColumnName = "CustomId")]
+ public int CustomId1 { get; set; }
+ [SugarColumn(IsIgnore = true)]
+ public List Items { get; set; }
+ }
+ public class UCustom24
+ {
+ public static void Init()
+ {
+ var db = NewUnitTest.Db;
+ db.DbMaintenance.TruncateTable();
+ db.Insertable(new ORdER() { Id1 = 1, Name1 = "jack", CreateTime1 = DateTime.Now, CustomId1 = 1 }).ExecuteCommand();
+ var test1 = db.Queryable()
+ .ToList(z => new
+ {
+ name1 = new { z.Id1, z.Name1, ZId = 100 }
+ }).First();
+
+ if (test1.name1.Id1 != 1 || test1.name1.Name1 != "jack" || test1.name1.ZId != 100)
+ {
+ throw new Exception("unit error");
+ }
+
+ var test2 = db.Queryable()
+ .ToList(z => new
+ {
+ name1 = new { z.Id1, z.Name1, ZId = z.Id1.ToString() }
+ }).First();
+
+ if (test2.name1.Id1 != 1 || test2.name1.Name1 != "jack" || test2.name1.ZId != "1")
+ {
+ throw new Exception("unit error");
+ }
+
+ var test3 = db.Queryable()
+ .Take(2)
+ .Select(i => new TestDTO
+ {
+ SubOne = new TestSubDTO { NameOne = "a1", NameTwo = i.Id1.ToString() },
+ // SubTwo = new TestSubDTO { NameOne = i.Name, NameTwo = i.Name }
+ })
+ .First();
+
+ if (test3.SubOne.NameOne != "a1" || test3.SubOne.NameTwo != "1")
+ {
+ throw new Exception("unit error");
+ }
+
+ var test4 = db.Queryable()
+ .Take(2)
+ .Select(i => new TestDTO
+ {
+ SubOne = new TestSubDTO { NameOne = "a1", NameTwo = i.Name1 },
+ //SubTwo = new TestSubDTO { NameOne = i.Name, NameTwo = i.Name }
+ })
+ .ToList().First();
+ if (test4.SubOne.NameOne != "a1" || test4.SubOne.NameTwo != "jack")
+ {
+ throw new Exception("unit error");
+ }
+
+ var test5 = db.Queryable()
+ .Take(2)
+ .Select(i => new TestDTO
+ {
+ SubOne = new TestSubDTO { NameOne = i.Name1, NameTwo = i.Name1 },
+ //SubTwo = new TestSubDTO { NameOne = i.Name, NameTwo = i.Name }
+ })
+ .ToList().First();
+ if (test5.SubOne.NameOne != "jack" || test5.SubOne.NameTwo != "jack")
+ {
+ throw new Exception("unit error");
+ }
+
+ var test6 = db.Queryable()
+ .Take(2)
+ .Select(i => new TestDTO
+ {
+ SubOne = new TestSubDTO { NameOne = i.Name1+"1", NameTwo = i.Name1+"2" },
+ SubTwo = new TestSubDTO { NameOne = i.Name1+"3", NameTwo = i.Name1+"4" }
+ })
+ .ToList().First();
+ if (test6.SubOne.NameOne != "jack1" || test6.SubOne.NameTwo != "jack2"||
+ test6.SubTwo.NameOne != "jack3" || test6.SubTwo.NameTwo != "jack4")
+ {
+ throw new Exception("unit error");
+ }
+ }
+
+ public class TestDTO
+ {
+ public TestSubDTO SubOne { get; set; }
+
+ public TestSubDTO SubTwo { get; set; }
+ }
+
+ public class TestSubDTO
+ {
+ public string NameOne { get; set; }
+
+ public string NameTwo { get; set; }
+ }
+ }
+}