/// <summary>
 ///     Called just before EF intends to call <see cref="DbCommand.ExecuteNonQuery()" />.
 /// </summary>
 /// <param name="command"> The command. </param>
 /// <param name="eventData"> Contextual information about the command and execution. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{Int32}.HasResult"/> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{Int32}.SuppressWithResult"/>.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{Int32}.HasResult"/> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{Int32}.HasResult"/> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{Int32}.Result"/> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual InterceptionResult <int> NonQueryExecuting(
     DbCommand command,
     CommandEventData eventData,
     InterceptionResult <int> result)
 => result;
 /// <summary>
 ///     Called when execution of a <see cref="DbDataReader"/> is about to be disposed. />.
 /// </summary>
 /// <param name="command"> The command. </param>
 /// <param name="eventData"> Contextual information about the command and reader. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed"/> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress"/>.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed"/> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed"/> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual InterceptionResult DataReaderDisposing(
     DbCommand command,
     DataReaderDisposingEventData eventData,
     InterceptionResult result)
 => result;
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbCommand.ExecuteScalar()" />.
 /// </summary>
 /// <param name="command"> The command. </param>
 /// <param name="eventData"> Contextual information about the command and execution. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{Object}.HasResult"/> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{Object}.SuppressWithResult"/>.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{Object}.HasResult"/> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{Object}.HasResult"/> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{Object}.Result"/> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual InterceptionResult <object> ScalarExecuting(
     DbCommand command,
     CommandEventData eventData,
     InterceptionResult <object> result) => result;
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbCommand.ExecuteReaderAsync()" />.
 /// </summary>
 /// <param name="command"> The command. </param>
 /// <param name="eventData"> Contextual information about the command and execution. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{DbDataReader}.HasResult"/> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{DbDataReader}.SuppressWithResult"/>.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{DbDataReader}.HasResult"/> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{DbDataReader}.HasResult"/> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{DbDataReader}.Result"/> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual Task <InterceptionResult <DbDataReader> > ReaderExecutingAsync(
     DbCommand command,
     CommandEventData eventData,
     InterceptionResult <DbDataReader> result,
     CancellationToken cancellationToken = default)
 => Task.FromResult(result);
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbCommand.ExecuteNonQueryAsync()" />.
 /// </summary>
 /// <param name="command"> The command. </param>
 /// <param name="eventData"> Contextual information about the command and execution. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{Int32}.HasResult"/> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{Int32}.SuppressWithResult"/>.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{Int32}.HasResult"/> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{Int32}.HasResult"/> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{Int32}.Result"/> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual Task <InterceptionResult <int> > NonQueryExecutingAsync(
     DbCommand command,
     CommandEventData eventData,
     InterceptionResult <int> result,
     CancellationToken cancellationToken = default)
 => Task.FromResult(result);
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbTransaction.RollbackAsync" />.
 /// </summary>
 /// <param name="transaction"> The transaction. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual Task <InterceptionResult> TransactionRollingBackAsync(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result,
     CancellationToken cancellationToken = default)
 => Task.FromResult(result);
 /// <inheritdoc />
 public virtual InterceptionResult RollingBackToSavepoint(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result)
 => result;
Esempio n. 8
0
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbConnection.BeginTransaction(IsolationLevel)" />.
 /// </summary>
 /// <param name="connection"> The connection. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     The current result, or null if no result yet exists.
 ///     This value will be non-null if some previous interceptor suppressed creation by returning a result from
 ///     its implementation of this method.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If the <see cref="Task" /> result is null, then EF will start the transaction as normal.
 ///     If the <see cref="Task" /> result is non-null value, then transaction creation is suppressed and the value contained in
 ///     the <see cref="InterceptionResult{TResult}" /> we be used by EF instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual Task <InterceptionResult <DbTransaction>?> TransactionStartingAsync(
     DbConnection connection, TransactionStartingEventData eventData, InterceptionResult <DbTransaction>?result,
     CancellationToken cancellationToken = default)
 => Task.FromResult(result);
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbConnection.CloseAsync()" /> in an async context.
 /// </summary>
 /// <param name="connection"> The connection. </param>
 /// <param name="eventData"> Contextual information about the connection. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to <see langword="true"/> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual Task <InterceptionResult> ConnectionClosingAsync(
     DbConnection connection,
     ConnectionEventData eventData,
     InterceptionResult result)
 => Task.FromResult(result);
Esempio n. 10
0
 /// <summary>
 ///     Called at the start of <see cref="M:DbContext.SaveChanges" />.
 /// </summary>
 /// <param name="eventData"> Contextual information about the <see cref="DbContext" /> being used. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{Int32}.HasResult" /> set to <see langword="true" /> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{Int32}.SuppressWithResult" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{Int32}.HasResult" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{Int32}.HasResult" /> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{Int32}.Result" /> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual InterceptionResult <int> SavingChanges(DbContextEventData eventData, InterceptionResult <int> result)
 => result;
Esempio n. 11
0
 /// <summary>
 ///     Called at the start of <see cref="M:DbContext.SaveChangesAsync" />.
 /// </summary>
 /// <param name="eventData"> Contextual information about the <see cref="DbContext" /> being used. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{Int32}.HasResult" /> set to <see langword="true" /> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{Int32}.SuppressWithResult" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{Int32}.HasResult" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{Int32}.HasResult" /> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{Int32}.Result" /> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual ValueTask <InterceptionResult <int> > SavingChangesAsync(
     DbContextEventData eventData,
     InterceptionResult <int> result,
     CancellationToken cancellationToken = default)
 => new ValueTask <InterceptionResult <int> >(result);
 /// <summary>
 ///     Called just before EF intends to call
 ///     <see cref="M:System.Data.Common.DbConnection.BeginTransactionAsync(System.Data.IsolationLevel,System.Threading.CancellationToken)" />.
 /// </summary>
 /// <param name="connection"> The connection. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{DbTransaction}.HasResult" /> set to <see langword="true" /> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{DbTransaction}.SuppressWithResult" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{DbTransaction}.HasResult" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{DbTransaction}.HasResult" /> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{DbTransaction}.Result" /> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual ValueTask <InterceptionResult <DbTransaction> > TransactionStartingAsync(
     DbConnection connection,
     TransactionStartingEventData eventData,
     InterceptionResult <DbTransaction> result,
     CancellationToken cancellationToken = default)
 => new ValueTask <InterceptionResult <DbTransaction> >(result);
 /// <inheritdoc />
 public virtual ValueTask <InterceptionResult> ReleasingSavepointAsync(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result,
     CancellationToken cancellationToken = default)
 => new ValueTask <InterceptionResult>(result);
 /// <inheritdoc />
 public virtual InterceptionResult ReleasingSavepoint(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result)
 => result;
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbTransaction.Commit" />.
 /// </summary>
 /// <param name="transaction"> The transaction. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual InterceptionResult TransactionCommitting(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result)
 => result;
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbConnection.Open()" />.
 /// </summary>
 /// <param name="connection"> The connection. </param>
 /// <param name="eventData"> Contextual information about the connection. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to <see langword="true"/> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual InterceptionResult ConnectionOpening(
     DbConnection connection,
     ConnectionEventData eventData,
     InterceptionResult result)
 => result;
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbTransaction.Rollback" />.
 /// </summary>
 /// <param name="transaction"> The transaction. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual InterceptionResult TransactionRollingBack(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result)
 => result;
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbConnection.OpenAsync()" />.
 /// </summary>
 /// <param name="connection"> The connection. </param>
 /// <param name="eventData"> Contextual information about the connection. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to <see langword="true"/> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual Task <InterceptionResult> ConnectionOpeningAsync(
     DbConnection connection,
     ConnectionEventData eventData,
     InterceptionResult result,
     CancellationToken cancellationToken = default)
 => Task.FromResult(result);
 /// <summary>
 ///     Called just before EF intends to call <see cref="DbConnection.BeginTransaction(IsolationLevel)" />.
 /// </summary>
 /// <param name="connection"> The connection. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult{DbTransaction}.HasResult" /> set to true if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult{DbTransaction}.SuppressWithResult" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <returns>
 ///     If <see cref="InterceptionResult{DbTransaction}.HasResult" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult{DbTransaction}.HasResult" /> is true, then EF will suppress the operation it
 ///     was about to perform and use <see cref="InterceptionResult{DbTransaction}.Result" /> instead.
 ///     A normal implementation of this method for any interceptor that is not attempting to change the result
 ///     is to return the <paramref name="result" /> value passed in, often using <see cref="Task.FromResult{TResult}" />
 /// </returns>
 public virtual InterceptionResult <DbTransaction> TransactionStarting(
     DbConnection connection,
     TransactionStartingEventData eventData,
     InterceptionResult <DbTransaction> result)
 => result;
 /// <summary>
 ///     Called just before EF intends to call
 ///     <see cref="M:System.Data.Common.DbTransaction.CommitAsync(System.Threading.CancellationToken)" />.
 /// </summary>
 /// <param name="transaction"> The transaction. </param>
 /// <param name="eventData"> Contextual information about connection and transaction. </param>
 /// <param name="result">
 ///     Represents the current result if one exists.
 ///     This value will have <see cref="InterceptionResult.IsSuppressed" /> set to <see langword="true" /> if some previous
 ///     interceptor suppressed execution by calling <see cref="InterceptionResult.Suppress" />.
 ///     This value is typically used as the return value for the implementation of this method.
 /// </param>
 /// <param name="cancellationToken"> The cancellation token. </param>
 /// <returns>
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is false, the EF will continue as normal.
 ///     If <see cref="InterceptionResult.IsSuppressed" /> is true, then EF will suppress the operation
 ///     it was about to perform.
 ///     A normal implementation of this method for any interceptor that is not attempting to suppress
 ///     the operation is to return the <paramref name="result" /> value passed in.
 /// </returns>
 public virtual ValueTask <InterceptionResult> TransactionCommittingAsync(
     DbTransaction transaction,
     TransactionEventData eventData,
     InterceptionResult result,
     CancellationToken cancellationToken = default)
 => new ValueTask <InterceptionResult>(result);