This commit is contained in:
sunkaixuan 2024-08-14 20:23:04 +08:00
parent fecc6e9f0a
commit a8d9923d2b
2 changed files with 47 additions and 0 deletions

View File

@ -33,6 +33,7 @@ namespace OrmTest
}
public static void Init()
{
Unitasxdfaaa.Init();
UnitSplitadfaf1.Init();
Unitaadfas1.Init();
Unitadfasda.Init();

View File

@ -0,0 +1,46 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrmTest
{
internal class Unitasxdfaaa
{
public static void Init()
{
var db = NewUnitTest.Db;
db.CodeFirst.InitTables<UnitMyEntity3>();
UnitMyEntity3 entity = new()
{
Id = Guid.NewGuid(),
ValueObject = new MyValueObject3
{
VOId = Guid.NewGuid(),
Name = "Name"
}
};
db.Insertable(entity).ExecuteCommand();
}
public class UnitMyEntity3
{
public Guid Id { get; init; }
[SugarColumn(IsOwnsOne = true)]
public MyValueObject3 ValueObject { get; set; }
}
public class MyValueObject3
{
[SugarColumn(ColumnName = "VALUEOBJECTID")]
public Guid VOId { get; set; }
[SugarColumn(ColumnName = "VALUEOBJECTNAME")]
public string Name { get; set; }
}
}
}