TransactionVote Énumération
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Spécifie les valeurs autorisées pour le vote des résultats des transactions.
public enum class TransactionVote
[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public enum TransactionVote
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Serializable>]
type TransactionVote =
Public Enum TransactionVote
- Héritage
- Attributs
Nom | Valeur | Description |
---|---|---|
Abort | 1 | Abandonne la transaction en cours. |
Commit | 0 | Valide la transaction en cours. |
L’exemple de code suivant illustre l’utilisation de cette énumération.
[assembly:System::Reflection::AssemblyKeyFile("Transaction.snk")];
[Transaction]
public ref class TransactionalComponent: public ServicedComponent
{
public:
void TransactionalMethod( String^ data )
{
ContextUtil::DeactivateOnReturn = true;
ContextUtil::MyTransactionVote = TransactionVote::Abort;
// do work with data
ContextUtil::MyTransactionVote = TransactionVote::Commit;
}
};
[Transaction]
public class TransactionalComponent : ServicedComponent
{
public void TransactionalMethod (string data)
{
ContextUtil.DeactivateOnReturn = true;
ContextUtil.MyTransactionVote = TransactionVote.Abort;
// Do work with data. Return if any errors occur.
// Vote to commit. If any errors occur, this code will not execute.
ContextUtil.MyTransactionVote = TransactionVote.Commit;
}
}
<Transaction()> _
Public Class TransactionalComponent
Inherits ServicedComponent
Public Sub TransactionalMethod(ByVal data As String)
ContextUtil.DeactivateOnReturn = True
ContextUtil.MyTransactionVote = TransactionVote.Abort
' Do work with data. Return if any errors occur.
' Vote to commit. If any errors occur, this code will not execute.
ContextUtil.MyTransactionVote = TransactionVote.Commit
End Sub
End Class
Cette énumération est utilisée par la classe ContextUtil.
Produit | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Commentaires sur .NET
.NET est un projet open source. Sélectionnez un lien pour fournir des commentaires :