DeleteMulti method

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 28-Apr-2010 18:56:06   

Hi may be a real simple/silly question. my apologies in advance.

is deletemulti atomic?

say i called the deletemulti on an entity collection with a predicate expression. and depending on the filter 8 entities has to be deleted but say 2 of them can not be deleted due to FK constraint. what happens?

thanks -shane

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Apr-2010 06:22:33   

It's atomic. Inside DeleteMulti a transaction is started, so if something goes wrong the framework rollback the transaction.

David Elizondo | LLBLGen Support Team
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 29-Apr-2010 07:05:47   

daelmo wrote:

It's atomic. Inside DeleteMulti a transaction is started, so if something goes wrong the framework rollback the transaction.

thank you daelmo.

one more question about transactions: this is from the hnd code.

in forummanager.cs, the deleteforum method creates a transaction and does the action in a try catch finally block.

the transaction is passed onto threadmanager class and deleteallthreadsinforum uses the same transaction to do the rest of the work. deleteallthreadsinforum itself calls other methods and passes the transaction onto them also. but this part of the code doesnt use try catches. the transaction is not committed there of course.

what if something wrong happens in one of the methods deleteallthreadsinforum uses? does the try catch finally in deleteforum method catch this and rollback all transactions?

i dont know if i was able to ask the question the way i aimed. please let me know if it doesnt make sense to you.

thanks -shane

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 29-Apr-2010 10:48:21   

The exception should bubble upward and be catched by the first catch() it meets.