NHibernate lazy loading nested collections with futures to avoid N+1 problem

后端 未结 3 1475
轮回少年
轮回少年 2020-12-14 04:07

I have an object model that looks like this (pseudo code):

class Product {
    public ISet Recommendations {get; set;}
    public ISet

        
3条回答
  •  不知归路
    2020-12-14 04:40

    Force an eager load on the part of the graph you care about using the NHibernateUtil class.

     NHibernateUtil.Initialize(Product.Recommendations);
    

    See the link below for further details.

    http://nhforge.org/wikis/howtonh/lazy-loading-eager-loading.aspx

提交回复
热议问题