Actually, the more I think about this the more confused I get:
Our application will sometimes allow the user to add multiple things to a record before saving them. Continuing with the custmer/order example, the web page might allow the user to add mutliple orders to a customerorder page (maybe some client-side code adds orders to a "grid" of some sort). When the user hits "Save", the presentation logic jumps into life and wants to save all of the new orders added for the customer.
So, what does it do? I want to avoid wrting "BL" code in this layer, and I def. want to avoid transaction stuff, so I ideally want to just say:
entCustomer.Orders = Page.Orders
Alternative:
collOrders = Page.Orders
This code is very high level, I would actually need to transform the page orders from a datagrid into for example a datatable before I can add it to my entCustomers.Orders..
Anyway, once the presentation layer has "populated" the entity, I need to call my BL to do the rest, so I call:
OrderManager.SaveOrders(entCustomer) // This passes the customer and orders
Alternative:
OrderManager.SaveOrders(entCustomer.ID, collOrders) // Pass the cust ID and orders
So, would the SaveOrders method do something like this:
public void SaveOrders(CustEntity entCust)
{
OrderManager.DeleteExistingOrders(entCust.ID); // Wipe what we already have assuming that this is OK
for i=0 to entCust.Orders.Count
entOrder = entCust.Orders(i)
OrderManager.Save(entCust)
next
}
Sorry for the loads of code, but I don't want to miss something obvious or over-complicate things!!