Click here to Skip to main content
14,038,887 members
Rate this:
 
Please Sign up or sign in to vote.
See more: , +
I have a scenario where we need to do multiple operations but all of those should be atomic which includes first writing rows in a table and after that using the Id for those rows writing a file for each of those on a network path and followed by writing to another table rows.

What i need here is all of this should be atomic operation, i.e. all steps should complete successfully, if any one of the process fails for some reason i want the changes done in that context to be rolled back.

I am aware of the TransactionScope class we use in ADO.Net and Entity Framework. But i need some mechanism to do these I/O operations and db action in one transaction.

What I have tried:

I have tried using TransactionScope but cannot figure out how to use that for both operations. It normally works for DB operation but not sure how it will behave for Disk I/O operation like creating a file.
Posted
Updated 14-Nov-18 3:34am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi,

As far as I know, you can use Transactional File Manager which is a .NET API that supports including file system operations such as file copy, move, delete, append, etc. in a transaction. However, this API is in fact a wrapper around Transactional NTFS

If this did not solve your problem then please leave a comment and I will assist you by improving my solution until your problem gets solved.

Cheers,
AH
   
v2
Comments
Ehsan Sajjad 18-Nov-18 23:41pm
   
i had saw while searching but thought there might be more better approach, but i think i need to stick to this library for now. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web02 | 2.8.190425.1 | Last Updated 14 Nov 2018
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100