private IQueryable<SysDept> LoadWithChildren(int depth, IQueryable<SysDept> query)
{
if (depth <= 0)
{
return query;
}
for (int i = 0; i < depth; i++)
{
query = query.Include($"{string.Concat(Enumerable.Repeat("Children.", i))}Children");
}
return query;
}
EFCore_循环获取多级导航属性
于 2024-07-27 13:07:12 首次发布