NHibernate Eager loading multi-level child objects

前端 未结 1 538
名媛妹妹
名媛妹妹 2020-12-23 18:26

I have a hierarchy of objects, Order, Contact, Address:

public class Order {
     public virtual Contact BillingContact { get; set; }
}

public class Contact         


        
1条回答
  •  一整个雨季
    2020-12-23 19:00

    I believe you might need to add an alias to BillingContact to allow you access to it's Address.

    Something like:

    var criteria = DetachedCriteria.For()
      .CreateAlias("BillingContact", "bc")
      .SetFetchMode("BillingContact", FetchMode.Eager)
      .SetFetchMode("bc.Address", FetchMode.Eager)
    

    0 讨论(0)
提交回复
热议问题