Linq for NHibernate and fetch mode of eager loading

前端 未结 4 1127
广开言路
广开言路 2020-12-13 03:37

Is there a way to set the fetchmode to eager for more than one object using linq for nhibernate. There seems to be an expand method which only allows me to set one object. H

4条回答
  •  隐瞒了意图╮
    2020-12-13 04:15

    In contiune to @Mike Hadlow answer, fetching next level (grandchildren) you need to do:

    var customers = session.Query() .FetchMany(c => c.Orders) .ThenFetchMany(o => o.OrderLines).ToList();

提交回复
热议问题