Eager load while using Linq in NHibernate 3

前端 未结 2 1494
小鲜肉
小鲜肉 2021-01-02 14:02

I need help with eager loading in with Linq in NHibernate 3 trunk version.

I have a many-to-many relationship like this:

public class Post
{
    pub         


        
2条回答
  •  鱼传尺愫
    2021-01-02 14:24

    For me this thread solve problem.

    Linq for NHibernate - filtering on foreign key causes extra lookup

    var linqsession = session.Linq();
    linqsession.QueryOptions.RegisterCustomAction(c => c.SetResultTransformer(new DistinctRootEntityResultTransformer()));
    var feedItemQuery = from ad in linqsession.Expand("Ads")
                        where ad.Id == Id
                        select ad
    

提交回复
热议问题