TransactionVote 列挙型

定義

トランザクションの結果判定に使用できる値を指定します。

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
継承
TransactionVote
属性

フィールド

Abort 1

現在のトランザクションを中止します。

Commit 0

現在のトランザクションをコミットします。

次のコード例では、この列挙体の使用方法を示します。


[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

注釈

この列挙は、ContextUtil クラスで使用します。

適用対象