mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-24 13:03:43 +08:00
Update Navigate query
This commit is contained in:
@@ -223,7 +223,8 @@ 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 instance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true);
|
||||||
var ilist = instance as IList;
|
var ilist = instance as IList;
|
||||||
foreach (var bInfo in bList)
|
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)
|
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));
|
var navList = selector(this.Context.Queryable<object>().AS(navEntityInfo.DbTableName).Where(conditionalModels));
|
||||||
foreach (var item in list)
|
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());
|
var setValue = navList.FirstOrDefault(x => navPkColumn.PropertyInfo.GetValue(x).ObjToString() == navColumn.PropertyInfo.GetValue(item).ObjToString());
|
||||||
navObjectNamePropety.SetValue(item, setValue);
|
navObjectNamePropety.SetValue(item, setValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OneToMany(List<object> list, Func<ISugarQueryable<object>, List<object>> selector, EntityInfo listItemEntity, System.Reflection.PropertyInfo navObjectNamePropety, EntityColumnInfo navObjectNameColumnInfo)
|
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())
|
if (navList.HasValue())
|
||||||
{
|
{
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
|
{
|
||||||
|
if (navObjectNamePropety.GetValue(item) == null)
|
||||||
{
|
{
|
||||||
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();
|
||||||
@@ -300,6 +307,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private SqlInfo GetWhereSql()
|
private SqlInfo GetWhereSql()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user