mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-26 22:25:49 +08:00
Synchronization code
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user