Update demo

This commit is contained in:
sunkaixuan 2024-07-22 16:36:03 +08:00
parent 4989ee12c6
commit 7f4bc97485
3 changed files with 38 additions and 1 deletions

View File

@ -8,7 +8,7 @@ namespace OrmTest
{
public class Config
{
public static string ConnectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=150.158.37.115)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL)));User Id=HBaa1dfa;Password=Qdies123test;Pooling='true';Max Pool Size=150";
public static string ConnectionString = DbHelper.Connection;
public static string ConnectionString2 = ConnectionString;
public static string ConnectionString3 = ConnectionString;
}

View File

@ -34,6 +34,7 @@ namespace OrmTest
}
public static void Init()
{
UnitValueObject.Init();
UnitBulkUpdate.Init();
UnitWeek.Init();
UnitSplitTask.Init();

View File

@ -39,8 +39,44 @@ namespace OrmTest
var list6 = db.Queryable<UnitafasMyEntity>()
.ToListAsync().GetAwaiter().GetResult();
db.CodeFirst.InitTables<MyEntity>();
db.Insertable(new MyEntity
{
Id = Guid.NewGuid(),
ValueObject = new MyValueObject
{
VoId = Guid.NewGuid(),
MyEnum = MyEnum.Value1
}
}).ExecuteCommand();
var entity = db.Queryable<MyEntity>().First(); // 值对象中有可空的枚举属性导致查询报错
}
}
[SugarTable("unitadfa")]
public class MyEntity
{
public Guid Id { get; set; }
[SugarColumn(IsOwnsOne = true)]
public MyValueObject ValueObject { get; set; }
}
public enum MyEnum
{
Value1,
Value2
}
public class MyValueObject
{
public Guid VoId { get; set; }
[SugarColumn(IsNullable = true, ColumnDataType = "NUMBER(1, 0)")]
public MyEnum? MyEnum { get; set; } // 值对象中有可空的枚举属性
}
public class UnitafasMyEntity
{
public Guid Id { get; set; }