Locked TransactionScope escalation

  • Friday, August 11, 2006 12:14 AM
     
     

    Hi


    We were excited by the potential of TransactionScope to simplify our data access code, eliminating the need to pass around a database transaction.

    After playing around with .NET 2.0 for a while we were very disappointed to find that unless you used the exact same connection object and kept it open for the duration of the transaction it would result in escalation to the DTC, even though all connections were to the same resource and using the same connection string.

    This leaves passing a connection around or creating a DbConnectionScope (mentioned in one of the forum post below) as the only option to avoid escalation. This is a little less than an ideal situation.

    This problem has been discussed pretty extensively in the two threads below.

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=113669&SiteID=1

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=531830&SiteID=1

    Jian Zeng from Microsoft test mentions in the first thread that it is a known issue and will be fixed in a later release.

    My question is; is this fix / modification going to be in the Orcas .NET release or will it be after that?

    This problem is a major road block to using TransactionScope in a real project. I would love to hear other peoples thoughts. Is this an issue for you too?

    Thanks Joel


    Vote on this issue here.

    https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=171884



All Replies

  • Friday, August 18, 2006 6:13 PM
     
     Answered

    This is actually a restriction within the implementation of SQLServer, rather than anything inherent in System.Transactions.

    I'll find out when they are scheduled to address this and post back here.

    Jack Loomis

    PM for XES Transactions

     

  • Friday, August 18, 2006 7:25 PM
     
     Answered

    As Jack said above, this is not something that we can fix on the client-side only; we need to change both the client and the server (and the client-server protocol actually) to make this work.

    We've had some discussions about this and have a design for the solution, but it's not yet clear whether/when we'll fix this. If we do fix it, it would enable the usual pattern where each component does open/close over a connection, and effectively there is never more than one connection opened at the same time.

    Pablo Castro
    ADO.NET Technical Lead
    Microsoft Corporation

  • Wednesday, August 30, 2006 4:56 AM
     
     
    Thanks for your comments.

    That explains the problem a bit more. It obviously isn't the simple solution that I thought.

    It would be great if you guys could have a fix in Orcas! :-)

    Thanks
    Joel
  • Sunday, March 11, 2007 11:14 PM
     
     
    Hi

    Is it possible yet, for someone to give us an update on whether this issue will be addressed in the Orcas .NET release?

    Thanks
    Joel
  • Saturday, March 17, 2007 1:30 AM
     
     Answered

    While I'm not the authority to speak for System.Data, the latest I know is that this issue will not be addressed in Orcas release.

    You might find the DBConnectionScope class useful to workaround this limitation:

    http://blogs.msdn.com/dataaccess/archive/2006/03/29/564299.aspx

    http://blogs.msdn.com/dataaccess/archive/2006/02/14/532026.aspx