mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-18 04:33:15 +08:00
Update NavigteManger
This commit is contained in:
parent
f9a6ea94ed
commit
016df23f44
@ -89,7 +89,11 @@ 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();
|
.ToList();
|
||||||
}
|
|
||||||
|
var list4 = db.Queryable<OperatorInfo>()
|
||||||
|
.Includes(x => x.Roles.Skip(10).Take(1).ToList())
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 描述:
|
/// 描述:
|
||||||
|
@ -250,13 +250,42 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
navObjectNamePropety.SetValue(listItem, instance);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
var navColumn = listItemEntity.Columns.FirstOrDefault(it => it.PropertyName == navObjectNameColumnInfo.Navigat.Name);
|
var navColumn = listItemEntity.Columns.FirstOrDefault(it => it.PropertyName == navObjectNameColumnInfo.Navigat.Name);
|
||||||
|
Loading…
Reference in New Issue
Block a user