EntityCollection.Load()也可以使用Include()来捕获下一个级别吗? [英] Can EntityCollection.Load() also use Include() to capture next level as well?

查看:71
本文介绍了EntityCollection.Load()也可以使用Include()来捕获下一个级别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!

我正在通过树遍历加载树顶,我的问题是,是否可以指定EntityCollection.Load还应包含()某些内容,即下一级,子项我已经完成了查询,就像我使用ObjectQuery一样我可以做什么?

最好的问候,

Henrik Dahl

Hello!

I'm loading a tree top down by a tree traversal and my question is if it's possible to specify that EntityCollection.Load should also Include() something, i.e. next levels, children already by the query done like I could do if I used ObjectQuery?


Best regards,

Henrik Dahl

推荐答案

Henrik,

目前没有可用于修改默认行为的Load的拦截点,但是如果你实现自己的加载,你可以采取CreateSourceQuery的优点是获取Load将执行的查询,以任何你想要的方式修改它(它只是和ObjectQuery< T>),然后执行它。我认为当你执行查询(使用默认的AppendOnly合并选项)时,这将对Load()产生非常类似的影响。我也相信存在多对多关系的情况,其中这与Load()的工作方式不同,但我不记得细节。

请告诉我这是否有帮助。

谢谢,
迭戈
Henrik,

There is currently no interception point for Load that you can use to modify the default behavior, but if you implement your own loading, you can take advantage of CreateSourceQuery to obtain the query that Load would have executed, modify it any way you want (it is just and ObjectQuery<T>), and then execute it. I think when you execute the query (with the default AppendOnly merge option) this will have a very similar effect to Load(). I also believe there is a case with many-to-many relationships in which this doesn't work the same as Load(), but I don't remember the details.

Please, let me know if this helps.

Thanks,
Diego


这篇关于EntityCollection.Load()也可以使用Include()来捕获下一个级别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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