mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 16:18:47 +08:00
Compatible with AOT
This commit is contained in:
parent
31f0119083
commit
67dc12e3a7
@ -1870,6 +1870,8 @@ namespace SqlSugar
|
||||
else
|
||||
{
|
||||
result = this.Context.Utilities.DataReaderToList<TResult>(dataReader);
|
||||
if (StaticConfig.EnableAot)
|
||||
ResetNavigationPropertiesForAot(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1914,6 +1916,8 @@ namespace SqlSugar
|
||||
else
|
||||
{
|
||||
result = await this.Context.Utilities.DataReaderToListAsync<TResult>(dataReader);
|
||||
if (StaticConfig.EnableAot)
|
||||
ResetNavigationPropertiesForAot(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1923,6 +1927,24 @@ namespace SqlSugar
|
||||
SetContextModel(result, entityType);
|
||||
return result;
|
||||
}
|
||||
private void ResetNavigationPropertiesForAot<TResult>(List<TResult> result)
|
||||
{
|
||||
if (StaticConfig.EnableAot)
|
||||
{
|
||||
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo<TResult>();
|
||||
var navColumnList = entityInfo.Columns.Where(it => it.Navigat != null);
|
||||
if (navColumnList.Any())
|
||||
{
|
||||
foreach (var item in result)
|
||||
{
|
||||
foreach (var columnInfo in navColumnList)
|
||||
{
|
||||
columnInfo.PropertyInfo.SetValue(item, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void _InQueryable(Expression expression, KeyValuePair<string, List<SugarParameter>> sqlObj)
|
||||
{
|
||||
QueryBuilder.CheckExpression(expression, "In");
|
||||
|
Loading…
Reference in New Issue
Block a user