0

I have a problem of implementing an atomic transaction that involves:

  1. File system operations like add, edit, move, copy and delete files.
  2. Linq operations (Entity Framework) like add object and save changes.

These two types of operations should be committed\Rolled back together.

I looked around for a solution and found out that (Transactional NTFS & The .NET TransactionScope class) is my best choice, now my question is does TransactionScope class supports EF linq operations? if you can provide me with simple examples I'm a bit lost here.

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86
Lisa
  • 3,121
  • 15
  • 53
  • 85
  • Possible duplicate of [How to write a transaction to cover Moving a file and Inserting record in database?](https://stackoverflow.com/questions/7939339/how-to-write-a-transaction-to-cover-moving-a-file-and-inserting-record-in-databa) – Ozkan Mar 19 '19 at 11:20

1 Answers1

1

Yes Linq to Sql supports .Net Transactions.SaveChanges applies Transaction with Isolation level ReadCommitted. If you do have to apply More than one SaveChanges within one Transaction then you explicitly apply Transactions. EF SaveChanges first checks whether there is already transaction it continues with it if not then It applies its own Transaction.If there is only one SaveChanges per transaction then there is no need to apply Transaction .

yo chauhan
  • 12,079
  • 4
  • 39
  • 58