When should one avoid using NHibernate's lazy-loading feature?

Most of what I hear about NHibernate's lazy-loading, is that it's better to use it, than not to use it. It seems like it just makes sense to minimize database access, in an effort to reduce bottlenecks. But few things come without trade-offs, certainly it slightly limits design by forcing you to have `virtual` properties. But I've also noticed that some developers turn lazy-loading off on certain often-used objects. This makes me wonder if there are some definite situations where data-access performance is hurt by using lazy-loading. So I wonder, when and in what situations should I avoid lazy-loading one of my NHibernate-persisted objects? Is the downside to lazy-loading merely in additional processing time, or can nhibernate lazy-loading also increase the data-access time (for instance, by making additional round-trips to the database)? Thanks!

以上就是When should one avoid using NHibernate's lazy-loading feature?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » WebStorm

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准