I use VB.net to connect to a SQL database.
I have a order table, and a orderline table.
Dim recOrderHeaders As IList(Of ShopifyData.OrderHeader)
recOrderHeaders = (From item In dbContext.OrderHeaders
Where (item.CustID = MyCustomer.CustID)
Order By item.OrderNo Descending
' Then I iterate through all the orders and find the order lines
for each item in recOrderHeaders
for each oLine in recOrderheaders.Orderlines
Iteration through order headers go quickly, but iteration through order lines takes a long time (on my case 60ms per line).
I thought all data was collected in the OrderHeader object from memory when using the ToList.
Typically each order has 1-5 lines.
How can I speed this up ? For example one customer has 90 orders and it takes 5 seconds to get all orders/orderlines.