Update navigate query

This commit is contained in:
sunkaixuan
2022-04-29 23:30:03 +08:00
parent 78fc491635
commit e22d8c56b3

View File

@@ -240,11 +240,21 @@ namespace SqlSugar
ilist.Add(bInfo);
}
}
if (sql.MappingExpressions.HasValue())
{
MappingFieldsHelper<T> helper = new MappingFieldsHelper<T>();
helper.NavEntity = bEntityInfo;
helper.RootEntity = this.Context.EntityMaintenance.GetEntityInfo<T>();
helper.SetChildList(navObjectNameColumnInfo, listItem, ilist.Cast<object>().ToList(), sql.MappingExpressions);
}
else
{
navObjectNamePropety.SetValue(listItem, instance);
}
}
}
}
}
private void OneToOne(List<object> list, Func<ISugarQueryable<object>, List<object>> selector, EntityInfo listItemEntity, System.Reflection.PropertyInfo navObjectNamePropety, EntityColumnInfo navObjectNameColumnInfo)
{
@@ -304,6 +314,17 @@ namespace SqlSugar
{
var setValue = navList
.Where(x => navColumn.PropertyInfo.GetValue(x).ObjToString() == listItemPkColumn.PropertyInfo.GetValue(item).ObjToString()).ToList();
if (sqlObj.MappingExpressions.HasValue())
{
MappingFieldsHelper<T> helper = new MappingFieldsHelper<T>();
helper.NavEntity = navEntityInfo;
helper.RootEntity = this.Context.EntityMaintenance.GetEntityInfo<T>();
helper.SetChildList(navObjectNameColumnInfo, item,setValue,sqlObj.MappingExpressions);
}
else
{
var instance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true);
var ilist = instance as IList;
foreach (var value in setValue)
@@ -315,6 +336,7 @@ namespace SqlSugar
}
}
}
}
private void Dynamic(List<object> list, Func<ISugarQueryable<object>, List<object>> selector, EntityInfo listItemEntity, System.Reflection.PropertyInfo navObjectNamePropety, EntityColumnInfo navObjectNameColumnInfo)
{