Using MDriven Framework, we want to use PreDelete
to clean up some linked objects that can't be handled automatically due to interdependencies (they need to be deleted in a particular order).
The class in question also has some M-M links with link objects (that should be auto deleted by the framework) and some composite links (that should result in linked objects to be auto deleted by the framework).
I assume that those auto deletions happen after return from PreDelete
.
What happens if some of these auto deletions fail? (E.g. if some cascade PreDelete
returns with canDelete == false
.)
Is the entire delete operation rolled back, including the operations performed by the original/main object's PreDelete
?
I would assume that the entire delete operation is wrapped by a transaction (IUndoService.StartTransaction
). Is this true? Otherwise, how is it done and what happens if the delete is canceled or throws?
Yes - everything is wrapped in a transaction and on fail to perform the whole everything is rolledback. Below is a snap of the code to get an idea of the flow: