TransactionVote 列舉

定義

指定允許用於交易結果表決的值。

C#
[System.Runtime.InteropServices.ComVisible(false)]
[System.Serializable]
public enum TransactionVote
繼承
TransactionVote
屬性

欄位

名稱 Description
Abort 1

中止目前交易。

Commit 0

認可目前交易。

範例

下列程式代碼範例示範此列舉的使用。

C#
[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;
    }
}

備註

這項列舉供 ContextUtil 類別使用。

適用於

產品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1