mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-24 04:53:45 +08:00
Update navigate query
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user