mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update demo
This commit is contained in:
parent
4989ee12c6
commit
7f4bc97485
@ -8,7 +8,7 @@ namespace OrmTest
|
|||||||
{
|
{
|
||||||
public class Config
|
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 ConnectionString2 = ConnectionString;
|
||||||
public static string ConnectionString3 = ConnectionString;
|
public static string ConnectionString3 = ConnectionString;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
UnitValueObject.Init();
|
||||||
UnitBulkUpdate.Init();
|
UnitBulkUpdate.Init();
|
||||||
UnitWeek.Init();
|
UnitWeek.Init();
|
||||||
UnitSplitTask.Init();
|
UnitSplitTask.Init();
|
||||||
|
@ -39,8 +39,44 @@ namespace OrmTest
|
|||||||
|
|
||||||
var list6 = db.Queryable<UnitafasMyEntity>()
|
var list6 = db.Queryable<UnitafasMyEntity>()
|
||||||
.ToListAsync().GetAwaiter().GetResult();
|
.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 class UnitafasMyEntity
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
Loading…
Reference in New Issue
Block a user