admin管理员组文章数量:1418371
If I explain a bit on my entities there is Routing
entity. Then it has Steps
in an one-to-many relationship.
public class Routing
{
public Guid Id { get; set; }
public Guid? DriverId { get; set; }
public List<Step> Steps { get; set; }
}
public class Step
{
public Guid Id { get; set; }
public Routing Routing { get; set; }
public Guid? RoutingId { get; set; }
public Guid? MenTaskId { get; set; }
public MenTask MenTask { get; set; }
}
Here is my EF Core query that I'm executing for getting routing and all linked step data:
List<Routing> routes = await _Routing.GetQueryableAsync())
.Include(x => x.Steps)
.OrderBy(Sorting)
.Skip(SkipCount)
.Take(MaxResultCount)
.ToList();
My question is, if I provide a MaxResultCount
of 10, then it will not retrieve data for Steps
array. But If I provide like 30 or above, then it will display steps data.
Then I try to google the issue and some says add below, and it didn't work.
foreach (var routing in routes)
{
await _Routing.EnsureCollectionLoadedAsync(routing, x => x.Steps);
}
Some says to add .AsSplitQuery()
before Skip()
and Take
, but that also won't work.
Any expert can guide me to trace the issue with above simple query?
本文标签: cAwkward behaviour with TAKE in EF Core queryStack Overflow
版权声明:本文标题:c# - Awkward behaviour with TAKE in EF Core query - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745287879a2651608.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论