TransactionVote TransactionVote TransactionVote TransactionVote Enum

Definizione

Specifica i valori consentiti per il voto sul risultato della transazione.Specifies the values allowed for transaction outcome voting.

public enum class TransactionVote
[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public enum TransactionVote
type TransactionVote = 
Public Enum TransactionVote
Ereditarietà
TransactionVoteTransactionVoteTransactionVoteTransactionVote
Attributi

Campi

Abort Abort Abort Abort 1

Interrompe la transazione corrente.Aborts the current transaction.

Commit Commit Commit Commit 0

Esegue il commit della transazione corrente.Commits the current transaction.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato l'utilizzo di questa enumerazione.The following code example demonstrates the use of this enumeration.


[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

Commenti

Questa enumerazione viene utilizzata dalla classe ContextUtil.This enumeration is used by the ContextUtil class.

Si applica a