views:

53

answers:

3

Hello,

I would Like to ask you, if there is a way to set some operations into transaction. I have problem such like this:

1) Generate File from data from database 2) Encrypt it 3) Send to server

I would like do it in one transaction. Any failured step 1-3 should cause the cancelling transaction.

Best regards,

+1  A: 

Yes. Check out TransactionScope and MSDTC.

this. __curious_geek
A: 

As curious_geek stated it can be achived with a TransactionScope. But it can be tricky to work with transactions, especially when you want to do more than one type of operation per transaction.

Are you even sure that you need a transaction? Cant you just delete the file again if step 2 or 3 fails?

Paw Baltzersen
A: 

I dont think you need a transaction for this as you only update the database in your last step. Any failure up to that point does not affect any other data from what you describe in your post.

Update: You may want to look at Volatile Resource Managers

James Westgate
I update database after first step. Second and third step, doesn't use a database
Karol Bladek
Ok. Updated....
James Westgate