diff --git a/Src/Asp.Net/MySqlTest/UnitTest/UnitSameKeyBug.cs b/Src/Asp.Net/MySqlTest/UnitTest/UnitSameKeyBug.cs index 8e866b2aa..565b59229 100644 --- a/Src/Asp.Net/MySqlTest/UnitTest/UnitSameKeyBug.cs +++ b/Src/Asp.Net/MySqlTest/UnitTest/UnitSameKeyBug.cs @@ -28,7 +28,28 @@ namespace OrmTest { throw new Exception("unit error"); } + db.CodeFirst.InitTables(); + db.Insertable(new ContactInfo() { Name = Guid.NewGuid() + "", Relationship = "a", Phone = "aa", Phone2 = "a", Address = "a" }) + .ExecuteCommand(); + var list2=db.Queryable() + .LeftJoin((x, y) => x.Name == y.Name) + .Select((x, y) => new UserInfoDTO() + { + Name=x.Name.SelectAll(), + ContacAll=y + }).ToList(); + var list3 = db.Queryable() + .LeftJoin((x, y) => x.Name == y.Name) + .Select((x, y) => new UserInfoDTO() + { + Name = x.Name.SelectAll(), + ContacAll = y + }).ToListAsync().GetAwaiter().GetResult(); + if (list3.First().ContacAll == null || list3.First().ContacAll==null) + { + throw new Exception("unit error"); + } } } @@ -41,6 +62,15 @@ namespace OrmTest [SugarColumn(IsJson = true)] public List ContacAll { get; set; } } + public class UserInfoDTO + { + [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + [SugarColumn(Length = 20, IsNullable = true)] + public string Name { get; set; } + + public ContactInfo ContacAll { get; set; } + } public class ContactInfo { ///