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.
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.

Reply via email to