From d27ee6f7087510441872ff7c503906ed0d13bd9a Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Thu, 21 Apr 2022 15:17:07 +0800 Subject: [PATCH] Update unit test --- Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs index 7331247fb..770d65bf7 100644 --- a/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs +++ b/Src/Asp.Net/SqlServerTest/UnitTest/UCustom012.cs @@ -37,6 +37,7 @@ namespace OrmTest db.Insertable(new StudentA() { StudentId = 2, SchoolId = 1, Name = "北大tom" }).ExecuteCommand(); db.Insertable(new StudentA() { StudentId = 3, SchoolId = 2, Name = "清华jack" }).ExecuteCommand(); db.Insertable(new StudentA() { StudentId = 4, SchoolId = 2, Name = "清华tom" }).ExecuteCommand(); + db.Insertable(new StudentA() { StudentId = 5, SchoolId = null, Name = "清华tom" }).ExecuteCommand(); db.Insertable(new TeacherA() { SchoolId = 1, Id = 1, Name = "北大老师01" }).ExecuteCommand(); db.Insertable(new TeacherA() { SchoolId = 1, Id = 2, Name = "北大老师02" }).ExecuteCommand(); @@ -60,7 +61,9 @@ namespace OrmTest .Where(x => x.SchoolA.School_Name.Contains("北大")) .ToList(); - + var list21 = db.Queryable() + .Mapper(it => it.SchoolA, it => it.SchoolId) + .ToList(); var list3 = db.Queryable() @@ -194,7 +197,8 @@ namespace OrmTest [SugarColumn(IsPrimaryKey = true)] public int StudentId { get; set; } public string Name { get; set; } - public int SchoolId { get; set; } + [SugarColumn(IsNullable =true)] + public int? SchoolId { get; set; } [Navigate(NavigateType.OneToOne, nameof(SchoolId))] public SchoolA SchoolA { get; set; } [Navigate(NavigateType.OneToMany, nameof(BookA.studenId))]