其他分享
首页 > 其他分享> > 何时使用延迟加载?

何时使用延迟加载?

作者:互联网

我对延迟加载的全部了解是,它仅在需要对象时才加载,我们应该使用它.
请向我解释我们必须使用和不使用哪种方案?
提前致谢.

解决方法:

我这样说:

Lazy loading is the essence of ORM. It is the principle of ORM. (unless we want to load complete DB in one shot)

查看Ayende的这篇文章:

NHibernate is lazy, just live with it

从那个来源的小引用:

…There is a good reason why lazy is set to true by default, and while I am sure that there is some limited number of scenarios where lazy=”false” is the appropriate choice, it isn’t for your scenario…

根据我的经验:

我很难解释比Ayende的帖子更好的了.但我必须确认-我以相同的方式看待它.我从未使用过NON惰性设置.如果应该一次装入一些东西,请使用投影:

>让ORM东西变得懒惰
>根据需要调整即席查询

标签:lazy-loading,nhibernate,c,fluent-nhibernate
来源: https://codeday.me/bug/20191028/1956023.html