Update ValueObject

This commit is contained in:
sunkaixuan 2024-01-31 00:12:15 +08:00
parent 657c1cd064
commit 18932437bc
3 changed files with 7 additions and 0 deletions

View File

@ -466,6 +466,7 @@ namespace SqlSugar
{
Check.ExceptionEasy($" {result.EntityName} "+ item.PropertyName+ " 存在重复定义 (IsOwnsOne) ", $" {result.EntityName} " + item.PropertyName + " Duplicate definition exists (IsOwnsOne)");
}
item.ForOwnsOnePropertyInfo = column.PropertyInfo;
result.Columns.Add(item);
}
}

View File

@ -318,6 +318,11 @@ namespace SqlSugar
}
private static object GetValue(T item, EntityColumnInfo column)
{
if (column.ForOwnsOnePropertyInfo != null)
{
var owsPropertyValue= column.ForOwnsOnePropertyInfo.GetValue(item, null);
return column.PropertyInfo.GetValue(owsPropertyValue, null);
}
if (StaticConfig.EnableAot)
{
return column.PropertyInfo.GetValue(item, null);

View File

@ -49,5 +49,6 @@ namespace SqlSugar
public bool IsDisabledAlterColumn { get; set; }
public string QuerySql { get; set; }
public bool IsOwnsOne { get; set; }
public PropertyInfo ForOwnsOnePropertyInfo { get; set; }
}
}