Showing posts from September, 2015

C# / SQL - Performing Distributed Transactions

Distributed Transactions span across multiple processes, which when encapsulated by the distributed transaction manager, will either commit a successful transaction or rollback changes. Distributed Transactions have been available within .NET, since .NET Framework 2.0. The Default Isolation level is set to Serializable, which in usage, creates unnecessary blocking and deadlocks. Therefore, it is suggested you override the default isolation level to ReadCommitted, which reflects the default within SQL Server.
/// /// This class is responsible for performing Distributed Transactions. /// public class DistributedTransactionUtility { /// /// The Distributed Transaction method which creates a Transaction Scope object /// and commits if there is no error and rollbacks, incase of exception. /// /// /// The method which performs multiple DB Transactions. /// public void DoDistributedTransaction(Action method) { // Initializes Transact…