ContextUtil.MyTransactionVote Eigenschap

Definitie

Hiermee haalt u de bit op of stelt u deze consistent in de COM+-context in.

public:
 static property System::EnterpriseServices::TransactionVote MyTransactionVote { System::EnterpriseServices::TransactionVote get(); void set(System::EnterpriseServices::TransactionVote value); };
public static System.EnterpriseServices.TransactionVote MyTransactionVote { get; set; }
static member MyTransactionVote : System.EnterpriseServices.TransactionVote with get, set
Public Shared Property MyTransactionVote As TransactionVote

Waarde van eigenschap

Een van de TransactionVote waarden, ofwel CommitAbort.

Uitzonderingen

Er is geen COM+-context beschikbaar.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u een eigenschap gebruikt MyTransactionVote om een transactionele ServicedComponentte maken.


[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

Opmerkingen

Wanneer MyTransactionVote deze optie is ingesteld Commit, wordt de COM+ consistent -bit ingesteld op true en de COM+-contextstemmen om de transactie door te voeren. Als MyTransactionVote dit is ingesteld Abortop, wordt de consistent bit ingesteld op false en worden de COM+-contextstemmen om de transactie af te breken. De standaardwaarde van de consistent bit is true.

De consistent bit voert een stem uit om de transactie waarin deze wordt uitgevoerd door te voeren of af te breken en de done bit voltooit de stemming. COM+ inspecteert de consistent bit wanneer de done bit is ingesteld true op een methode-aanroep retourneren of wanneer het object wordt gedeactiveerd. Hoewel de bit van consistent een object herhaaldelijk kan worden gewijzigd binnen elke methodeaanroep, worden alleen de laatste wijzigingsaantallen gewijzigd.

Van toepassing op