Share via


ContextUtil.MyTransactionVote Özellik

Tanım

COM+ bağlamında biti consistent alır veya ayarlar.

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

Özellik Değeri

Değerlerden TransactionVote biri veya CommitAbort.

Özel durumlar

Kullanılabilir COM+ bağlamı yoktur.

Örnekler

Aşağıdaki kod örneği, bir işlem ServicedComponentoluşturmak için özelliğinin nasıl kullanılacağını MyTransactionVote gösterir.


[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

Açıklamalar

MyTransactionVote olarak ayarlandığındaCommit, COM+ consistent biti olarak ayarlanır true ve COM+ bağlamı işlemi işlemek için oy kullanır. olarak ayarlanırsa MyTransactionVoteAbortconsistent, bit olarak ayarlanır false ve COM+ bağlamı işlemi durdurmak için oy kullanır. Bitin consistent varsayılan değeri şeklindedir true.

Bit, consistent yürütülürken gerçekleştirilen işlemi işlemek veya durdurmak için bir oy atar ve done bit oyunu son haline gönderir. COM+ bir yöntem çağrısı dönüşünde done bit olarak ayarlandığında true veya nesne devre dışı bırakıldığında biti incelerconsistent. Her yöntem çağrısında bir nesnenin biti consistent art arda değişese de, yalnızca son değişiklik sayılır.

Şunlara uygulanır