Deletion of an Entity in a child collection

Posts   
 
    
Posts: 11
Joined: 29-Mar-2005
# Posted on: 26-May-2005 15:34:58   

I have an Entity with a child collection. What I need to do is be able to delete any entity in the collection and do any updates within one transaction. This is using self servicing code. Can anyone tell me how to do this?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 27-May-2005 11:12:35   

crazylittlemonkeys wrote:

I have an Entity with a child collection. What I need to do is be able to delete any entity in the collection and do any updates within one transaction. This is using self servicing code. Can anyone tell me how to do this?

If you want to delete all entities in teh collection, which updates do you want to perform as well? The entity which contains the child collection?

You can use a UnitOfWork object: add the entity to the unit of work object for save, then add the child collection for delete. Then commit the unitofwork, it then first does the updates (or first the inserts, then the updates) and after that the deletes, in one transaction.

Frans Bouma | Lead developer LLBLGen Pro