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,7 +240,17 @@ namespace SqlSugar
|
|||||||
ilist.Add(bInfo);
|
ilist.Add(bInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
navObjectNamePropety.SetValue(listItem, instance);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,13 +314,25 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
var setValue = navList
|
var setValue = navList
|
||||||
.Where(x => navColumn.PropertyInfo.GetValue(x).ObjToString() == listItemPkColumn.PropertyInfo.GetValue(item).ObjToString()).ToList();
|
.Where(x => navColumn.PropertyInfo.GetValue(x).ObjToString() == listItemPkColumn.PropertyInfo.GetValue(item).ObjToString()).ToList();
|
||||||
var instance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true);
|
|
||||||
var ilist = instance as IList;
|
if (sqlObj.MappingExpressions.HasValue())
|
||||||
foreach (var value in setValue)
|
|
||||||
{
|
{
|
||||||
ilist.Add(value);
|
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)
|
||||||
|
{
|
||||||
|
ilist.Add(value);
|
||||||
|
}
|
||||||
|
navObjectNamePropety.SetValue(item, instance);
|
||||||
}
|
}
|
||||||
navObjectNamePropety.SetValue(item, instance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user