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:
@@ -223,7 +223,8 @@ namespace SqlSugar
|
||||
{
|
||||
foreach (var listItem in list)
|
||||
{
|
||||
|
||||
if (navObjectNamePropety.GetValue(listItem) == null)
|
||||
{
|
||||
var instance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true);
|
||||
var ilist = instance as IList;
|
||||
foreach (var bInfo in bList)
|
||||
@@ -239,6 +240,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OneToOne(List<object> list, Func<ISugarQueryable<object>, List<object>> selector, EntityInfo listItemEntity, System.Reflection.PropertyInfo navObjectNamePropety, EntityColumnInfo navObjectNameColumnInfo)
|
||||
{
|
||||
@@ -258,11 +260,14 @@ namespace SqlSugar
|
||||
}));
|
||||
var navList = selector(this.Context.Queryable<object>().AS(navEntityInfo.DbTableName).Where(conditionalModels));
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (navObjectNamePropety.GetValue(item) == null)
|
||||
{
|
||||
var setValue = navList.FirstOrDefault(x => navPkColumn.PropertyInfo.GetValue(x).ObjToString() == navColumn.PropertyInfo.GetValue(item).ObjToString());
|
||||
navObjectNamePropety.SetValue(item, setValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OneToMany(List<object> list, Func<ISugarQueryable<object>, List<object>> selector, EntityInfo listItemEntity, System.Reflection.PropertyInfo navObjectNamePropety, EntityColumnInfo navObjectNameColumnInfo)
|
||||
{
|
||||
@@ -287,6 +292,8 @@ namespace SqlSugar
|
||||
if (navList.HasValue())
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (navObjectNamePropety.GetValue(item) == null)
|
||||
{
|
||||
var setValue = navList
|
||||
.Where(x => navColumn.PropertyInfo.GetValue(x).ObjToString() == listItemPkColumn.PropertyInfo.GetValue(item).ObjToString()).ToList();
|
||||
@@ -300,6 +307,7 @@ namespace SqlSugar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SqlInfo GetWhereSql()
|
||||
{
|
||||
|
Reference in New Issue
Block a user