When you call Dispose for a DataAccessAdapter, if and only if there are transactions in progress, they will be rolled back.
And here is the DataAccessAdapter implementation of the IDisposable:
#region IDisposable
/// <summary>
/// Implements the IDispose' method Dispose.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Implements the Dispose functionality. If a transaction is in progress, it will rollback that transaction.
/// </summary>
/// <param name="isDisposing">Flag which signals this routine if a dispose action should take place (true) or not (false)</param>
protected virtual void Dispose(bool isDisposing)
{
// Check to see if Dispose has already been called.
if(!_isDisposed)
{
if(isDisposing)
{
// Dispose managed resources.
if(_physicalTransaction != null)
{
if(_isTransactionInProgress)
{
Rollback();
}
else
{
#if !CF
_physicalTransaction.Dispose();
#endif
_physicalTransaction = null;
}
}
DisposePostponedDisposeCandidates();
if(_activeConnection != null)
{
// closing the connection will abort (rollback) any pending transactions
if(_activeConnection.State == ConnectionState.Open)
{
_activeConnection.Close();
}
#if !CF
_activeConnection.Dispose();
#endif
_activeConnection = null;
}
if( this.InSystemTransaction )
{
#if !CF && !MONO
// set transaction and resource manager to null, so the adapter goes out of scope as soon as the System.Transactions.Transaction is going out of scope
_systemTransactionResourceManager = null;
_systemTransaction = null;
_systemTransactionEnlistment = null;
#endif
}
_isDisposed = true;
}
}
}
#endregion