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

前端 未结 5 415
礼貌的吻别
礼貌的吻别 2021-01-02 15:32

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

5条回答
  •  伪装坚强ぢ
    2021-01-02 16:26

    If you are using a webservice between the client and server handling the database access using nhibernate it might be problematic using lazy loading since the object will be serialized and sent over the webservice and subsequent usage of "objects" further down in the object relationship needs a new trip to the database server using additional webservices. In such an instance it might not be too good using lazy loading. A word of caution, be careful in what you fetch if you turn lazy loading of, its way to easy to not think this through and through and end up fetching almost the whole database...

提交回复
热议问题