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,19 +223,21 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
foreach (var listItem in list)
|
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)
|
|
||||||
{
|
{
|
||||||
var pk = listItemPkColumn.PropertyInfo.GetValue(listItem).ObjToString();
|
var instance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true);
|
||||||
var bid = bPkColumn.PropertyInfo.GetValue(bInfo).ObjToString();
|
var ilist = instance as IList;
|
||||||
if (abids.Any(x => x.Aid == pk&& x.Bid== bid))
|
foreach (var bInfo in bList)
|
||||||
{
|
{
|
||||||
|
var pk = listItemPkColumn.PropertyInfo.GetValue(listItem).ObjToString();
|
||||||
|
var bid = bPkColumn.PropertyInfo.GetValue(bInfo).ObjToString();
|
||||||
|
if (abids.Any(x => x.Aid == pk && x.Bid == bid))
|
||||||
|
{
|
||||||
ilist.Add(bInfo);
|
ilist.Add(bInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
navObjectNamePropety.SetValue(listItem, instance);
|
||||||
}
|
}
|
||||||
navObjectNamePropety.SetValue(listItem, instance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,8 +261,11 @@ namespace SqlSugar
|
|||||||
var navList = selector(this.Context.Queryable<object>().AS(navEntityInfo.DbTableName).Where(conditionalModels));
|
var navList = selector(this.Context.Queryable<object>().AS(navEntityInfo.DbTableName).Where(conditionalModels));
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
var setValue = navList.FirstOrDefault(x => navPkColumn.PropertyInfo.GetValue(x).ObjToString() == navColumn.PropertyInfo.GetValue(item).ObjToString());
|
if (navObjectNamePropety.GetValue(item) == null)
|
||||||
navObjectNamePropety.SetValue(item, setValue);
|
{
|
||||||
|
var setValue = navList.FirstOrDefault(x => navPkColumn.PropertyInfo.GetValue(x).ObjToString() == navColumn.PropertyInfo.GetValue(item).ObjToString());
|
||||||
|
navObjectNamePropety.SetValue(item, setValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,15 +293,18 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
var setValue = navList
|
if (navObjectNamePropety.GetValue(item) == null)
|
||||||
.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;
|
|
||||||
foreach (var value in setValue)
|
|
||||||
{
|
{
|
||||||
ilist.Add(value);
|
var setValue = navList
|
||||||
|
.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;
|
||||||
|
foreach (var value in setValue)
|
||||||
|
{
|
||||||
|
ilist.Add(value);
|
||||||
|
}
|
||||||
|
navObjectNamePropety.SetValue(item, instance);
|
||||||
}
|
}
|
||||||
navObjectNamePropety.SetValue(item, instance);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user