diff --git a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
index b4e89eba2..a533e40dc 100644
--- a/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
+++ b/Src/Asp.Net/SqlServerTest/SqlServerTest.csproj
@@ -174,6 +174,7 @@
+
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs b/Src/Asp.Net/SqlServerTest/UnitTest/Main.cs
index ec05ed163..6fb90d321 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()
{
+ USelectSinleDTO.Init();
UCustom024.Init();
UCustom24.Init();
UCustom20.Init();
diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/USelectSinleDTO.cs b/Src/Asp.Net/SqlServerTest/UnitTest/USelectSinleDTO.cs
new file mode 100644
index 000000000..3893e57d2
--- /dev/null
+++ b/Src/Asp.Net/SqlServerTest/UnitTest/USelectSinleDTO.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SqlSugar;
+namespace OrmTest
+{
+ public class USelectSinleDTO
+ {
+ public static void Init()
+ {
+ var db = NewUnitTest.Db;
+ Dto1(db);
+ Dto2(db);
+ Dto3(db);
+ db.CodeFirst.InitTables();
+ db.Insertable(new ClassA() { fId = 1, username = "a" }).ExecuteCommand();
+ var list = db.Queryable().Select().ToList();
+ if (list.First().fId != 1 && list.First().username != "a") throw new Exception("unit error");
+ db.DbMaintenance.DropTable();
+ }
+
+ private static void Dto1(SqlSugarClient db)
+ {
+ var sql = db.Queryable().Select().ToSql();
+ if (sql.Key != "SELECT [f_id] AS fId ,[user_name] AS username FROM [ClassA] ")
+ {
+ throw new Exception("unit error");
+ }
+ }
+ private static void Dto2(SqlSugarClient db)
+ {
+ var sql = db.Queryable().Select().ToSql();
+ if (sql.Key != "SELECT [user_name] AS username FROM [ClassA] ")
+ {
+ throw new Exception("unit error");
+ }
+ }
+ private static void Dto3(SqlSugarClient db)
+ {
+ var sql = db.Queryable().Select().ToSql();
+ if (sql.Key != "SELECT [f_id] AS f_id ,[user_name] AS username FROM [ClassA] ")
+ {
+ throw new Exception("unit error");
+ }
+ }
+
+
+ public class ClassA
+ {
+ [SqlSugar.SugarColumn(ColumnName = "f_id")]
+ public int fId { get; set; }
+ [SqlSugar.SugarColumn(ColumnName = "user_name")]
+ public string username { get; set; }
+ }
+ public class ClassDTO3
+ {
+
+ public int f_id { get; set; }
+
+ public string username { get; set; }
+ }
+ public class ClassDTO2
+ {
+
+ public int fId2 { get; set; }
+
+ public string username { get; set; }
+ }
+ public class ClassDTO
+ {
+
+ public int fId { get; set; }
+
+ public string username { get; set; }
+ }
+ }
+}