私が正しく、最も効率的/これを捕捉するために見つけた最高の方法があります。次のように
//Register for the transaction completed event for the current transaction
Transaction.Current.TransactionCompleted += new TransactionCompletedEventHandler(Current_TransactionCompleted);
その後、イベントハンドラ関数を作成します。
/// <summary>
/// Handles the TransactionCompleted event of the Current control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Transactions.TransactionEventArgs"/> instance containing the event data.</param>
static void Current_TransactionCompleted(object sender, TransactionEventArgs e)
{
if (e.Transaction.TransactionInformation.Status == TransactionStatus.Committed)
{
/// Yay it's committed code goes here!
}
}
が引用するMSDN
「あなたが代わりに取引のための結果情報を取得するために揮発性の入隊を使用して、このイベントのために登録することができます。 TransactionCompletedEventHandlerデリゲートに渡されるパラメータは、Transactionインスタンスです。次に、特定のインスタンスのTransactionInformationプロパティをクエリして、TransactionInformationのインスタンスを取得できます。そのStatusプロパティCommitted値またはAborted値を持つトランザクションのステータスが含まれます。
現在のコードベースの例を投稿すると役立ちます。 – Oded