NHibernate Lazy =“额外". [英] NHibernate Lazy="Extra"
问题描述
关于lazy ="extra"到底具有什么功能,是否有很好的解释?
Is there a good explanation out there on what exactly lazy="extra" is capable of?
我所见过的所有帖子都重复了一个事实,即它将对MyObject.ItsCollection.Count
的引用转换为select count(*)查询(假设它们尚未加载).
All the posts I've seen all just repeat the fact that it turns references to MyObject.ItsCollection.Count
into select count(*) queries (assuming they're not loaded already).
我想知道它是否具有更强大的功能,例如将MyObject.ItsCollection.Any(o => o.Whatever == 5)
转换为SELECT ...EXISTS
查询.
I'd like to know if it's capable of more robust things, like turning MyObject.ItsCollection.Any(o => o.Whatever == 5)
into a SELECT ...EXISTS
query.
文档的第18.1节仅涉及该内容.我不是NH开发人员,因此如果不花点时间完成所有工作,就无法真正进行实验和观看SQL Profiler.我只是在寻找某种描述此功能功能的参考.
Section 18.1 of the docs only touches on it. I'm not an NH developer, so I can't really experiment with it and watch SQL Profiler without doing a bit of work getting everything set up; I'm just looking for some sort of reference describing what this feature is capable of.
谢谢!
推荐答案
对于版本2.x,它仅用于将collection.Count()
转换为select count
,据我在源代码中所见,它将还允许构造物collection[5]
获取该特定实体(索引为5),而不是对整个集合进行水化处理.
for version 2.x it is only used to translate a collection.Count()
into a select count
and as far as i can see in the source, it will also allow the construct collection[5]
to fetch that particular entity (with index 5) instead of hydrating the whole collection.
对于3.x版,我没有在发行说明中看到任何相关内容
For version 3.x i didn't see anything related in the release notes
这篇关于NHibernate Lazy =“额外".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!