none
ADO.NET 2.0 Transactionscopeoptions clarity RRS feed

  • Question

  • Can someone show me(or provide the links) with proper and complete examples, the difference between different transactionscopeoptions(Required,RequiresNew, Supress). I have been unable to find complete and descriptive examples through net.

    Thanks.

    Tuesday, December 18, 2007 7:09 PM

Answers

All replies

  • EDIT

     

    Beyond the docs which is very clear with the Transactionscope options the long tutorial in the link below covers what you need to know about System.Transaction class.  One more thing TransactionScope options are in System.Transactions not ADO.NET, they are application layer transcations not the same with ADO.NET transaction which is in Data Access.

     

    http://msdn2.microsoft.com/en-us/library/ms973865.aspx

     

    Tuesday, December 18, 2007 8:36 PM
  • Thanks for replying. I had gone through the article in the link that you have posted, before. The article though explains the concepts very well, doesnt give practical examples. The examples which the link sites are more kind of generic. I was specifically looking for real world examples which would make my understanding clearer, with reagrds to the transactions.

    One example quoted from the article is given below

    using(TransactionScope scope1 = new TransactionScope())
    {
       try
       {
          //Start of non-transactional section
          using(TransactionScope scope2 = new
    TransactionScope(TransactionScopeOption.Suppress))
          {
             //Do non-transactional work here
          }
          //Restores ambient transaction here
       }
       catch
       {}
       //Rest of scope1
    }

    This just explains the generic steps but doesnt give the detailed picture in totality something like a real world scenario and the behaviour of transactions in that scenario. I hope you understand what i am asking for. If you could refer me the links with complete examples, it would be nice.

     

    Thanks.

     

    Tuesday, December 18, 2007 8:46 PM
  • Complete examples are not easy to find because the Transaction Programming team deals with only application layer transaction while the ADO.NET team has very good atomic transaction with clean nesting but in Data Access.  That said here are three that may help.

     

    He was a member of the Asp.net team at the time of this posting now he is part of the ADO.NET team and I found out most issues relevant to SQL Server from his postings.

     

    http://blogs.msdn.com/angelsb/archive/2005/02/12/371557.aspx

     

    He is a member of Transaction Programming team so an expert.

     

    http://www.pluralsight.com/blogs/jimjohn/archive/2005/06/18/11451.aspx

     

     

    The Docs covering the options.

    http://msdn2.microsoft.com/en-us/library/ms172152(VS.90).aspx

     

    Tuesday, December 18, 2007 9:21 PM