Today I was reviewing some code. Now who can spot the exception that can be thrown in the finally block? I will give you a couple of hints:
using(IDbTransaction transaction = connection.BeginTransaction(IsolationLevel.Serializable))
{
IDbDataAdapter dataAdapter = null;
try
{
dataAdapter = CreateDataAdapter();
dataAdapter.UpdateCommand = updateCommand;
dataAdapter.UpdateCommand.Connection = connection;
dataAdapter.UpdateCommand.Transaction = transaction;
dataAdapter.TableMappings.Add("Table", "S114_PTCAR");
dataAdapter.Update(Ptcars);
transaction.Commit();
}
finally
{
((IDisposable) dataAdapter).Dispose();
}
}
I will post the solution tomorrow.