Tuesday, November 24, 2015

Implementing TransactionScope

The TransactionScope class provides a simple way to mark a block of code as participating in a transaction, without requiring you to interact with the transaction itself.

Steps

  1. Add reference to System.Transactions                                                                             








   2.  Include namespace -->using System.Transactions;
   
   3.  Use transaction scope as  shown below

using (System.Transactions.TransactionScope scope = new        System.Transactions.TransactionScope())
      {
        //Insert
        //Update
        
        scope.Complete();
 
      
      }

No comments:

Post a Comment