Recursive delete logic?

Posts   
 
    
GizmoTN76
User
Posts: 36
Joined: 22-Oct-2007
# Posted on: 03-Mar-2008 00:44:14   

I'm looking for an elegant way to peform a recursive delete based off the deleted entities contained in the Collection's removed entity tracker. The recursive save is wonderful because you can place that logic at a base form and it handles all the ordering etc for you and I'm looking for a similar solution to deal with the deleted entities.

I guess the removedentitytracker on the collection is relatively new as there's no obvious way I've found to pull the removed entities out of the entity graph in a similar way that the ObjectGraphUtils can grab all of the inserted and updated ones out. I wrote some really ugly code to try to handle the situation but it seems like there should be an easier way to do it.

I guess what I'm looking for is a method that I can pass an entitycollection to that will return a distinct list of all the deleted entities in the entire graph so that they can be passed to a UnitOfWork2 and commited along with the normal recursive save tasks. It would also be nice to have a similar technique to be able to clear the removedentitytrackers in the graph after a successful commit. I'm hoping I'm missing a class somewhere in the framework or there's a smart way to utilize the objectgraphutils to achieve this goal.

Thanks in advance...

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Mar-2008 04:52:18   

There isn't a direct public method provided by LLBLGen. Please read some implementations at the forum. For example: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=9692

David Elizondo | LLBLGen Support Team