nHibernate performance issue when loading large collections

后端 未结 3 1221
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 02:37

(just to make clear: my app isn\'t really about employees and departments. I just use these terms for example\'s sake).
Each department has an employees collection, whic

3条回答
  •  伪装坚强ぢ
    2020-12-12 02:55

    hmmmm. may be its too much, and actually - i'd expect an "lazy=extra" ISet to behave like this, but you can write your own "extra lazy" ISet. if you didn't encounter an extra lazy collection - its a collection that, for example, when you ask its count, it doesn't fetch everything but issues a count query. your extra lazy ISet could issue an exists query whenever you try to add something.

    If you implement this, your code would be clean and you could submit the code to nhibernate core.

    you should however think about add range, and be careful not to issue N queries

    good luck.

提交回复
热议问题