Share via


ContextUtil.DeactivateOnReturn Özellik

Tanım

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

public:
 static property bool DeactivateOnReturn { bool get(); void set(bool value); };
public static bool DeactivateOnReturn { get; set; }
static member DeactivateOnReturn : bool with get, set
Public Shared Property DeactivateOnReturn As Boolean

Özellik Değeri

true yöntem döndürdüğünde nesne devre dışı bırakılacaksa; aksi takdirde , false. Varsayılan değer: false.

Özel durumlar

Kullanılabilir COM+ bağlamı yoktur.

Örnekler

Aşağıdaki kod örneği, bir yöntem çağrısından sonra özelliğinin DeactivateOnReturnServicedComponent devre dışı bırakıldığından emin olmak için özelliğinin kullanımını 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

COM+ done biti, çalışmasını tamamladıktan sonra nesnenin ne kadar süre etkin kalacağını belirler ve bir işlemin süresini etkileyebilir. Bir yöntem çağrısı döndürdüğünde, COM+ biti done inceler. done Bit isetrue, COM+ nesneyi devre dışı bırakır. done Bit ise falsenesne devre dışı bırakılmaz.

Şunlara uygulanır