src/EFCore.MySql/Storage/Internal/MySqlRelationalTransaction.cs
/// <summary>
///     Discards all changes made to the database in the current transaction.
/// </summary>
Discards all changes made to the database in the current transaction.
Discards all changes made to the database in the current transaction .
public virtual async Task RollbackAsync(CancellationToken cancellationToken=default(CancellationToken))
        {
            var startTime = DateTimeOffset.UtcNow;
            var stopwatch = Stopwatch.StartNew();
            try
            {
                if (_dbTransaction is MySqlTransaction)
                {
                    await (_dbTransaction as MySqlTransaction).RollbackAsync(cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    _dbTransaction.Rollback();
                }
                _logger.TransactionRolledBack(
                    _relationalConnection,
                    _dbTransaction,
                    TransactionId,
                    startTime,
                    stopwatch.Elapsed);
            }
            catch (Exception e)
            {
                _logger.TransactionError(
                    _relationalConnection,
                    _dbTransaction,
                    TransactionId,
                    "RollbackAsync",
                    e,
                    startTime,
                    stopwatch.Elapsed);
                throw;
            }
            ClearTransaction();
        }
public virtual async Task RollbackAsync ( CancellationToken cancellationToken = default ( CancellationToken ) ) { var startTime = DateTimeOffset . UtcNow ; var stopwatch = Stopwatch . StartNew ( ) ; try { if ( _dbTransaction is MySqlTransaction ) { await ( _dbTransaction as MySqlTransaction ) . RollbackAsync ( cancellationToken ) . ConfigureAwait ( false ) ; } else { _dbTransaction . Rollback ( ) ; } _logger . TransactionRolledBack ( _relationalConnection , _dbTransaction , TransactionId , startTime , stopwatch . Elapsed ) ; } catch ( Exception e ) { _logger . TransactionError ( _relationalConnection , _dbTransaction , TransactionId , " " , e , startTime , stopwatch . Elapsed ) ; throw ; } ClearTransaction ( ) ; }
Discards all changes made to the database in the current transaction.
Discards all changes made to the database in the current transaction .
cancellationToken
CancellationToken