简体   繁体   English

EF 7 .Include不会检索子级的父级

[英]EF 7 .Include doesn't retrieve child's recored of parent

I use EF7 RC1 and have this code but only child's of first parent record retrieve: 我使用EF7 RC1并具有以下代码,但只有第一个父级记录的子级检索:

var res = await _labcontext.Customers
                    .Include(x => x.Invoives)
                    .OrderBy(x => x.Title)
                    .AsNoTracking()
                   .Skip((page - 1) * pagesize).Take(pagesize)
                   .ToListAsync();

This is a bug in EF7 or my code? 这是EF7还是我的代码中的错误?

It seams we should call pagination before include, I change my code as bellow and work fine. 它包含了我们应该在包含之前调用分页的功能,我将代码更改为波纹管并可以正常工作。

var res = await _labcontext
                    .Customers.AsNoTracking()
                     .Skip((page - 1) * pagesize).Take(pagesize)
                    .Include(x => x.Invoives)
                      .OrderBy(x => x.Title)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM