diff --git a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitdafadsyssww.cs b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitdafadsyssww.cs new file mode 100644 index 000000000..20330a0d9 --- /dev/null +++ b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/Unitdafadsyssww.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using SqlSugar; +namespace OrmTest +{ + public class Unitdfassyss + { + public static void Init() + { + var db = NewUnitTest.Db; + //建表 + db.CodeFirst.InitTables(); + //清空表 + db.DbMaintenance.TruncateTable(); + var enableKey = false; + var result = db.Queryable() + .Cast() + .Select(t => new + { + t.id, + + key = enableKey ? t.key : null + }) + .ToList(); + enableKey = true; + var result2 = db.Queryable() + .Cast() + .Select(t => new + { + t.id, + + key = enableKey ? t.key : null + }) + .ToList(); + + Console.WriteLine(result); + Console.WriteLine("用例跑完"); + Console.ReadKey(); + } + //建类 + public class NoKeyTable + { + public int id { get; set; } + } + + public class MayHaveKeyTable + { + public int id { get; set; } + public string? key { get; set; } + } + } +} \ No newline at end of file