mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Compatible with AOT
This commit is contained in:
parent
31f0119083
commit
67dc12e3a7
@ -1870,11 +1870,13 @@ namespace SqlSugar
|
||||
else
|
||||
{
|
||||
result = this.Context.Utilities.DataReaderToList<TResult>(dataReader);
|
||||
if (StaticConfig.EnableAot)
|
||||
ResetNavigationPropertiesForAot(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.Bind.DataReaderToList<TResult>(entityType, dataReader);
|
||||
result = this.Bind.DataReaderToList<TResult>(entityType, dataReader);
|
||||
}
|
||||
SetContextModel(result, entityType);
|
||||
return result;
|
||||
@ -1914,15 +1916,35 @@ namespace SqlSugar
|
||||
else
|
||||
{
|
||||
result = await this.Context.Utilities.DataReaderToListAsync<TResult>(dataReader);
|
||||
if (StaticConfig.EnableAot)
|
||||
ResetNavigationPropertiesForAot(result);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await this.Bind.DataReaderToListAsync<TResult>(entityType, dataReader);
|
||||
result = await this.Bind.DataReaderToListAsync<TResult>(entityType, dataReader);
|
||||
}
|
||||
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