/// <summary> /// Sends <see cref="M:System.Data.Entity.Infrastructure.Interception.IDbTransactionInterceptor.Disposing(System.Data.Common.DbTransaction,System.Data.Entity.Infrastructure.Interception.DbTransactionInterceptionContext)" /> and /// <see cref="M:System.Data.Entity.Infrastructure.Interception.IDbTransactionInterceptor.Disposed(System.Data.Common.DbTransaction,System.Data.Entity.Infrastructure.Interception.DbTransactionInterceptionContext)" /> to any <see cref="T:System.Data.Entity.Infrastructure.Interception.IDbConnectionInterceptor" /> /// registered on <see cref="T:System.Data.Entity.Infrastructure.Interception.DbInterception" /> before/after making a /// call to <see cref="M:System.Data.Common.DbTransaction.Dispose" />. /// </summary> /// <param name="transaction">The transaction on which the operation will be executed.</param> /// <param name="interceptionContext">Optional information about the context of the call being made.</param> public virtual void Dispose( DbTransaction transaction, DbInterceptionContext interceptionContext) { Check.NotNull <DbTransaction>(transaction, nameof(transaction)); Check.NotNull <DbInterceptionContext>(interceptionContext, nameof(interceptionContext)); DbTransactionInterceptionContext interceptionContext1 = new DbTransactionInterceptionContext(interceptionContext); if (transaction.Connection != null) { interceptionContext1 = interceptionContext1.WithConnection(transaction.Connection); } this.InternalDispatcher.Dispatch <DbTransaction, DbTransactionInterceptionContext>(transaction, (Action <DbTransaction, DbTransactionInterceptionContext>)((t, c) => t.Dispose()), interceptionContext1, (Action <IDbTransactionInterceptor, DbTransaction, DbTransactionInterceptionContext>)((i, t, c) => i.Disposing(t, c)), (Action <IDbTransactionInterceptor, DbTransaction, DbTransactionInterceptionContext>)((i, t, c) => i.Disposed(t, c))); }
/// <summary> /// Sends <see cref="IDbTransactionInterceptor.Disposing" /> and /// <see cref="IDbTransactionInterceptor.Disposed" /> to any <see cref="IDbConnectionInterceptor" /> /// registered on <see cref="DbInterception" /> before/after making a /// call to <see cref="DbTransaction.Dispose()" />. /// </summary> /// <param name="transaction">The transaction on which the operation will be executed.</param> /// <param name="interceptionContext">Optional information about the context of the call being made.</param> public virtual void Dispose(DbTransaction transaction, DbInterceptionContext interceptionContext) { Check.NotNull(transaction, "transaction"); Check.NotNull(interceptionContext, "interceptionContext"); var clonedInterceptionContext = new DbTransactionInterceptionContext(interceptionContext); if (transaction.Connection != null) { clonedInterceptionContext = clonedInterceptionContext.WithConnection(transaction.Connection); } InternalDispatcher.Dispatch( transaction, (t, c) => t.Dispose(), clonedInterceptionContext, (i, t, c) => i.Disposing(t, c), (i, t, c) => i.Disposed(t, c)); }