OrderHistory Multiple Database Trips
Hello,
Is there a better, more efficent way of populating the OrderItems (BLL) collection for each Order (BLL) rather than calling the database to get the OrderItems after creating each order. Could one stored procedure be designed to pull back all the information and then populate the OrderDetails (DAL) and OrderItemDetails (DAL) objects, then hand these back to the BusinessLogicLayer so that it could create the Orders (BLL) and then when creating the orderItems(BLL) the BusinessLogicLayer could loop through the collection of OrderItemDetails(DAL) to retrieve the orderItems (BLL) for each order. I guess one way to implement this would be to have the DAL return an 'OrderHistory' object that
contained a list of OrderDetails (DAL) and a list of OrderItemDetails (DAL). Then the business layer could sort this with out a trip for each order to the DB as seen in the method
GetOrderFromOrderDetails in App_Code/BLL/Store/Order.cs
Has anyone thought about this or have any ideas? Its just if I have 20 orders to display for a customer then its one trip to the database to get the list of orders and another 20 to get the order deails for each one.
Cheers
Scott
|