/// <summary> /// Releases the unmanaged resources used by the <see cref="DbTransaction"/>. /// </summary> /// <param name="disposing">false if being called from a <c>finalizer</c></param> protected override void Dispose(bool disposing) { if (disposing && _transaction != null) { _transaction.Dispose(); } _transaction = null; _connection = null; base.Dispose(disposing); }
/// <summary> /// Initializes a new instance of the <see cref="LoggingDbTransaction"/> class. /// </summary> /// <param name="transaction">The transaction.</param> /// <param name="connection">The connection.</param> /// <exception cref="ArgumentNullException">Throws when the <paramref name="transaction"/> or <paramref name="connection"/> is <c>null</c>.</exception> public LoggingDbTransaction(DbTransaction transaction, LoggingDbConnection connection) { _transaction = transaction ?? throw new ArgumentNullException(nameof(transaction)); _connection = connection ?? throw new ArgumentNullException(nameof(connection)); }