mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-18 22:35:46 +08:00
Update NavigteManger
This commit is contained in:
parent
f9a6ea94ed
commit
016df23f44
@ -88,6 +88,10 @@ namespace OrmTest
|
|||||||
}
|
}
|
||||||
var list2=db.Queryable<OperatorInfo>()
|
var list2=db.Queryable<OperatorInfo>()
|
||||||
.Includes(x => x.Roles.MappingField(z=>z.name,()=>x.username).ToList())
|
.Includes(x => x.Roles.MappingField(z=>z.name,()=>x.username).ToList())
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var list4 = db.Queryable<OperatorInfo>()
|
||||||
|
.Includes(x => x.Roles.Skip(10).Take(1).ToList())
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +249,15 @@ namespace SqlSugar
|
|||||||
helper.SetChildList(navObjectNameColumnInfo, listItem, ilist.Cast<object>().ToList(), sql.MappingExpressions);
|
helper.SetChildList(navObjectNameColumnInfo, listItem, ilist.Cast<object>().ToList(), sql.MappingExpressions);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (sql.Skip != null || sql.Take != null)
|
||||||
|
{
|
||||||
|
var instanceCast = (instance as IList);
|
||||||
|
var newinstance = Activator.CreateInstance(navObjectNamePropety.PropertyType, true) as IList;
|
||||||
|
SkipTakeIList(sql, instanceCast, newinstance);
|
||||||
|
navObjectNamePropety.SetValue(listItem, newinstance);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
navObjectNamePropety.SetValue(listItem, instance);
|
navObjectNamePropety.SetValue(listItem, instance);
|
||||||
}
|
}
|
||||||
@ -256,6 +265,26 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SkipTakeIList(SqlInfo sql, IList instanceCast, IList newinstance)
|
||||||
|
{
|
||||||
|
var intArray = Enumerable.Range(0, instanceCast.Count);
|
||||||
|
if (sql.Skip != null)
|
||||||
|
{
|
||||||
|
intArray = intArray
|
||||||
|
.Skip(sql.Skip.Value);
|
||||||
|
}
|
||||||
|
if (sql.Take != null)
|
||||||
|
{
|
||||||
|
intArray = intArray
|
||||||
|
.Take(sql.Take.Value);
|
||||||
|
}
|
||||||
|
foreach (var i in intArray)
|
||||||
|
{
|
||||||
|
newinstance.Add(instanceCast[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user