Вы можете перехватить System.Transactions.TransactionException в методе транзакции
try
{
//Create the transaction scope
using (TransactionScope scope = new TransactionScope())
{
//Register for the transaction completed event for the current transaction
Transaction.Current.TransactionCompleted += new TransactionCompletedEventHandler(Current_TransactionCompleted);
// proces the transaction
}
}
catch (System.Transactions.TransactionAbortedException ex)
{
Console.WriteLine(ex);
}
catch (System.Transactions.TransactionException ex)
{
Console.WriteLine(ex);
}
catch
{
Console.WriteLine("Cannot complete transaction");
throw;
}
Обработчик события транзакции завершен
static void Current_TransactionCompleted(object sender, TransactionEventArgs e)
{
Console.WriteLine("A transaction has completed:");
Console.WriteLine("ID: {0}", e.Transaction.TransactionInformation.LocalIdentifier);
Console.WriteLine("Distributed ID: {0}", e.Transaction.TransactionInformation.DistributedIdentifier);
Console.WriteLine("Status: {0}", e.Transaction.TransactionInformation.Status);
Console.WriteLine("IsolationLevel: {0}", e.Transaction.IsolationLevel);
}