diff --git a/Src/Asp.NetCore2/OracleTest/UserTestCases/UnitTest/UnitValueObject.cs b/Src/Asp.NetCore2/OracleTest/UserTestCases/UnitTest/UnitValueObject.cs new file mode 100644 index 000000000..0bcf73027 --- /dev/null +++ b/Src/Asp.NetCore2/OracleTest/UserTestCases/UnitTest/UnitValueObject.cs @@ -0,0 +1,80 @@ +using SqlSugar.DbConvert; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace OrmTest +{ + internal class UnitValueObject + { + public static void Init() + { + var db = NewUnitTest.Db; + + db.CodeFirst.InitTables(); + db.Insertable(new UnitafasMyEntity() + { + Id=Guid.NewGuid(), + P0="a", + P1=1, + MyVO=new MyVO() { + GuidP1=Guid.NewGuid(), + GuidP2=Guid.NewGuid(), + VoId=Guid.NewGuid() + } + }).ExecuteCommand(); + var list5 = db.Queryable() + .Select(e => new + { + e.Id, + e.MyVO.GuidP1, + e.MyVO.GuidP2 + }) + .ToListAsync().GetAwaiter().GetResult(); + } + } + public class UnitafasMyEntity + { + public Guid Id { get; set; } + + public string P0 { get; set; } + + public int P1 { get; set; } + + [SugarColumn(IsOwnsOne = true)] + public MyVO MyVO { get; set; } + } + + public class MyVO + { + public Guid VoId { get; set; } + + public Guid GuidP1 { get; set; } + + public Guid GuidP2 { get; set; } + } + public class UnitAddressadfafa2221 + { + public string Street { get; set; } + public string City { get; set; } + + public string ZipCode { get; set; } + [SugarColumn(ColumnDataType ="VARCHAR(20)",SqlParameterDbType = typeof(EnumToStringConvert))]//CommonPropertyConvertORM自带的 + public DbType DbType { get; set; } + + } + public class UnitCustomeradfafas1 + { + [SqlSugar.SugarColumn(IsPrimaryKey = true)] + public int CustomerId { get; set; } + public string Name { get; set; } + [SqlSugar.SugarColumn(IsOwnsOne = true)] + public UnitAddressadfafa2221 Address { get; set; } + + } +} diff --git a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitValueObject.cs b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitValueObject.cs index 656d58db8..0df3ae3a7 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitValueObject.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/UserTestCases/UnitTest/UnitValueObject.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; +using System.Xml; namespace OrmTest { @@ -112,8 +113,48 @@ namespace OrmTest { throw new Exception("unit error"); } + db.CodeFirst.InitTables(); + db.Insertable(new UnitafasMyEntity() + { + Id=Guid.NewGuid(), + P0="", + P1=1, + MyVO=new MyVO() { + GuidP1=Guid.NewGuid(), + GuidP2=Guid.NewGuid(), + VoId=Guid.NewGuid() + } + }).ExecuteCommand(); + var list5 = db.Queryable() + .Select(e => new + { + e.Id, + e.MyVO.GuidP1, + e.MyVO.GuidP2 + }) + .ToListAsync().GetAwaiter().GetResult(); } } + public class UnitafasMyEntity + { + public Guid Id { get; set; } + + public string P0 { get; set; } + + public int P1 { get; set; } + + [SugarColumn(IsOwnsOne = true)] + public MyVO MyVO { get; set; } + } + + public class MyVO + { + public Guid VoId { get; set; } + + public Guid GuidP1 { get; set; } + + public Guid GuidP2 { get; set; } + } public class UnitAddressadfafa2221 { public string Street { get; set; } diff --git a/Src/Asp.NetCore2/SqlSugar.GBaseCore/SqlSugar.GBaseCore.nuspec b/Src/Asp.NetCore2/SqlSugar.GBaseCore/SqlSugar.GBaseCore.nuspec index 5e5142983..40761ea6d 100644 --- a/Src/Asp.NetCore2/SqlSugar.GBaseCore/SqlSugar.GBaseCore.nuspec +++ b/Src/Asp.NetCore2/SqlSugar.GBaseCore/SqlSugar.GBaseCore.nuspec @@ -2,7 +2,7 @@ SqlSugar.GBaseCore - 5.1.4.152 + 5.1.4.166 sunkaixuan Landa http://www.apache.org/licenses/LICENSE-2.0.html