Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Catch 22
Message
 
 
À
10/09/2013 12:29:29
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01581904
Message ID:
01582757
Vues:
39
>>I've discussed this problem with David Browne from MS by email and the problem seems to be in the fact that we're opening the connection prior to instantiating this TransactionScope object and so the existed connections will not enlist in the transactions.
>>
>>I'm going to verify if .NET documentation explicitly states this fact but now what should I do?
>>
>>Thanks.

>
>That makes sense that it would work this way, I guess. You shouldn't leave connections open for any longer than necessary (but you probably already know that), so the question is *why* is your connection already open? And obviously, that part of your code (opening the connection) needs to also be within a TransactionScope.

David suggested this code
sqlConnection.EnlistTransaction(Transaction.Current);
which worked after I introduced a new property and disabled check for uncommitted transactions (when this new property is set to true) and explicit committing of them which we were doing in each SQL call.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform