Sorry about that. You are correct. The corrected class definition is: public class Customer { public long CustomerId {get; set;} public CustomerType CustomerType {get; set;} public List<CustomerOrder> CustomerOrders {get; set;} }
On Tuesday, October 30, 2012 10:17:42 AM UTC-5, Guido wrote: > Well maybe you should correct the class definition you posted then. I see > no list in your class. > > > On Tue, Oct 30, 2012 at 3:54 PM, rema <rema...@yahoo.com <javascript:>>wrote: > >> .ThenFetch(co => co.Item) <=== At this time co is a list of customer >> orders so I have to do a select >> >> >> >> On Tuesday, October 30, 2012 9:07:16 AM UTC-5, Guido wrote: >> >>> Why not >>> >>> .ThenFetch(co => co.Item)) >>> >>> ? >>> >>> >>> On Mon, Oct 29, 2012 at 3:44 PM, rema <rema...@yahoo.com> wrote: >>> >>>> I have the following object structure: >>>> >>>> public class CustomerType >>>> { >>>> public int CustomerTypeId {get; set;} >>>> public string TypeName {get; set;} >>>> } >>>> >>>> public class Customer >>>> { >>>> public long CustomerId {get; set;} >>>> public CustomerType CustomerType {get; set;} >>>> public CustomerOrder CustomerOrders {get; set;} >>>> } >>>> >>>> public class CustomerOrder >>>> { >>>> public long CustomerOrderId {get; set;} >>>> public Item Item {get; set;} >>>> } >>>> >>>> public class Item >>>> { >>>> public int ItemId {get; set;} >>>> public string ItemName {get; set;} >>>> } >>>> >>>> My Query looks like: >>>> >>>> var query = >>>> session.Query<Customer().**Where(cus => cus.CustomerId >>>> == customerId) >>>> .Fetch(c => c.CustomerType) >>>> .Fetch(c => c.CustomerOrders) >>>> .ThenFetch(co => co.Select(it => it.Item)).ToList(); >>>> >>>> But I get the following error: >>>> >>>> "A fetch request must be a simple member access expression; '[100002]' >>>> is a SubQueryExpression instead.\r\nParameter name: relatedObjectSelector" >>>> >>>> If I remove the last .ThenFetch - then it works just fine. >>>> >>>> I do need to load the Item object >>>> >>>> Any ideas? >>>> >>>> Thanks >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Fluent NHibernate" group. >>>> To view this discussion on the web visit https://groups.google.com/d/** >>>> msg/fluent-nhibernate/-/**iVb2xQHYlGcJ<https://groups.google.com/d/msg/fluent-nhibernate/-/iVb2xQHYlGcJ> >>>> . >>>> To post to this group, send email to fluent-n...@**googlegroups.com. >>>> To unsubscribe from this group, send email to fluent-nhibern...@** >>>> googlegroups.com. >>>> >>>> For more options, visit this group at http://groups.google.com/** >>>> group/fluent-nhibernate?hl=en<http://groups.google.com/group/fluent-nhibernate?hl=en> >>>> . >>>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Fluent NHibernate" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/fluent-nhibernate/-/8l-F2SL4JDUJ. >> >> To post to this group, send email to >> fluent-n...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> fluent-nhibern...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/fluent-nhibernate?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To view this discussion on the web visit https://groups.google.com/d/msg/fluent-nhibernate/-/VZEjcrCaJJMJ. To post to this group, send email to fluent-nhibernate@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.