How can I retrieve, say, all the lineitems for all orders in a customer object?
I am trying
grdView.DataSource = customer.Orders.
but after orders, all I get is "GetMulti"...I don't see the lineitems collection.
I can understand doing this for one order
grdView.DataSource = customer.Orders(0).LineItems
but how do I get all the lineitems for all orders?
my entities are Customer, Order, LineItem
I want to display all the lineitems in a gridview before saving. How can I do this using llblgen pro runtime?
In order to get all of the LineItem entities, you should use relations and filters to populate a LineItemCollection. Here is the LLBLGen Documentation for multi-entity filters. To be able to filter the results on the specific customer you want, you need to add relations to get the related entities required.
(This assumes you are using SelfServicing. Check documentation for Adapter.)
// Make a link through relations from LineItem to Order to Customer
RelationCollection relations = new RelationCollection();
relations.Add(LineItemEntity.Relations.OrderEntityUsingLineItemId);
relations.Add(OrderEntity.Relations.CustomerEntityUsingOrderId);
// Filter on the customer id
PredicateExpression filter = new PredicateExpression();
filter.Add(CustomerFields.CustomerId == CustomerId);
// Get LineItems based on the relations and filters above
LineItemCollection collection = new LineItemCollection();
collection.GetMulti(filter, 0, null, relations);