Linq支持延迟加载? [英] Linq Supports Lazy loading?

查看:73
本文介绍了Linq支持延迟加载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我,

实体框架工作默认支持延迟加载。

Entity frame work default support Lazy Loading.

Linq的Lazy加载支持怎么样。

What about Lazy loading support by Linq.

问候

Krrish

推荐答案

LINQ可以通过多种方式工作,具体取决于它的选择(LINQ到实体,LINQ到对象等),但在所有方面它使用延迟执行的情况。

LINQ can work in a variety of ways depending on what its selecting from (LINQ to entities, LINQ to objects etc), but in all cases it uses deferred execution.

也就是说,当你声明一个LINQ语句时,在它需要之前什么也没有实际执行。通常,这是在您开始枚举查询时(或使用诸如"Count"之类的聚合函数)。

That is, when you declare a LINQ statement, nothing actually executes until it needs to. Generally this is when you start enumerating the query (or use an aggregate function such as "Count").

仅在此时LINQ查询"执行内容",其中包括访问它需要的任何属性。如果这些属性以惰性方式声明,那么此时它们也将被评估。

It is only at this point that the LINQ query "does stuff", which includes accessing any properties that it needs to. If these properties are declared in a lazy way then it is at this point that they will be evaluated as well.


这篇关于Linq支持延迟加载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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