Transactions and AddNew() ?

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 30-Nov-2007 19:41:25   

Selfservicing, 2.5 C#

I have a customer in a transaction (customer.Transaction is not null)

When I call this line of code:

order = customer.OrderCollection.AddNew();

order.Transaction is null.

Is there a way to tell the top level object that all object made in all children all join the same transaction as the top object, in this can customer?

Ian

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 01-Dec-2007 11:45:19   

This is done when you save Customer. AddNew() adds a new order to the list, but doesn't add it to a set transaction per se. It's similar to OrderCollection.Add(order), that too doesn't add order to an existing transaction.

When you save Customer, its orders will also be added to that transaction.

Frans Bouma | Lead developer LLBLGen Pro