Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Catch 22
Message
De
10/09/2013 15:39:49
 
 
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:
01582765
Vues:
42
>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.


Ah ... I didn't think of that. With the normal use of TransactionScope (wrapping all database access, which eliminates the need for SqlTransaction use totally), that wouldn't be necessary because the TransactionScopeOption.Required automatically enlists the transaction in any existing current transaction. Sometimes you don't want to do that, however, and the way to prevent automatic enlistment is to use the TransactionScopeOption.RequiresNew ... then the scope will be "self-contained" (for lack of a better word).

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform