EF渴望加载多个子子集合 [英] EF eager load multiple child child collections

查看:101
本文介绍了EF渴望加载多个子子集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎找不到如何急于在EF中加载多个子子集合的方法。所以我可以这样做:

I can't seem to find how to eager load multiple child child collections in EF. So I can do:

blawConext.Blaws
    .Include(b => b.ChildCollection
             .Select(cc => cc.ChildChildCollection)
     )

我甚至可以更深入没有问题,但是我无法获得umm同行?收集,以下内容不起作用

I can even go deeper and deeper without a problem but I can't get the umm peer? collection, The below does not work

blawConext.Blaws
    .Include(b => b.ChildCollection
             .Select(cc => cc.ChildChildCollection1)
             .Select(cc => cc.ChildChildCollection2)
     )


推荐答案

您可以指定多个包含项:

You can specify multiple includes:

blawConext.Blaws
    .Include(b => b.ChildCollection.Select(cc => cc.ChildChildCollection1))
    .Include(b => b.ChildCollection.Select(cc => cc.ChildChildCollection2))

这篇关于EF渴望加载多个子子集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆