Delen via


DbCommandInterceptor Class

Definition

Abstract base class for IDbCommandInterceptor for use when implementing a subset of the interface methods.

public abstract class DbCommandInterceptor : Microsoft.EntityFrameworkCore.Diagnostics.IDbCommandInterceptor, Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor
type DbCommandInterceptor = class
    interface IDbCommandInterceptor
    interface IInterceptor
Public MustInherit Class DbCommandInterceptor
Implements IDbCommandInterceptor, IInterceptor
Inheritance
DbCommandInterceptor
Implements

Remarks

See EF Core interceptors for more information and examples.

Constructors

DbCommandInterceptor()

Methods

CommandCanceled(DbCommand, CommandEndEventData)

Called when a command was canceled.

CommandCanceledAsync(DbCommand, CommandEndEventData, CancellationToken)

Called when a command was canceled.

CommandCreated(CommandEndEventData, DbCommand)

Called immediately after EF calls CreateCommand().

This method is still called if an interceptor suppressed creation of a command in CommandCreating(CommandCorrelatedEventData, InterceptionResult<DbCommand>). In this case, result is the result returned by CommandCreating(CommandCorrelatedEventData, InterceptionResult<DbCommand>).

CommandCreating(CommandCorrelatedEventData, InterceptionResult<DbCommand>)

Called just before EF intends to call CreateCommand().

CommandFailed(DbCommand, CommandErrorEventData)

Called when execution of a command has failed with an exception.

CommandFailedAsync(DbCommand, CommandErrorEventData, CancellationToken)

Called when execution of a command has failed with an exception.

CommandInitialized(CommandEndEventData, DbCommand)

Called after EF has initialized CommandText and other command configuration.

DataReaderClosing(DbCommand, DataReaderClosingEventData, InterceptionResult)

Called just before EF intends to call Close().

DataReaderClosingAsync(DbCommand, DataReaderClosingEventData, InterceptionResult)

Called just before EF intends to call CloseAsync() in an async context.

DataReaderDisposing(DbCommand, DataReaderDisposingEventData, InterceptionResult)

Called when execution of a DbDataReader is about to be disposed.

NonQueryExecuted(DbCommand, CommandExecutedEventData, Int32)

Called immediately after EF calls ExecuteNonQuery().

This method is still called if an interceptor suppressed execution of a command in NonQueryExecuting(DbCommand, CommandEventData, InterceptionResult<Int32>). In this case, result is the result returned by NonQueryExecuting(DbCommand, CommandEventData, InterceptionResult<Int32>).

NonQueryExecutedAsync(DbCommand, CommandExecutedEventData, Int32, CancellationToken)

Called immediately after EF calls ExecuteNonQueryAsync().

This method is still called if an interceptor suppressed execution of a command in NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken). In this case, result is the result returned by NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken).

NonQueryExecuting(DbCommand, CommandEventData, InterceptionResult<Int32>)

Called just before EF intends to call ExecuteNonQuery().

NonQueryExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Int32>, CancellationToken)

Called just before EF intends to call ExecuteNonQueryAsync().

ReaderExecuted(DbCommand, CommandExecutedEventData, DbDataReader)

Called immediately after EF calls ExecuteReader().

This method is still called if an interceptor suppressed execution of a command in ReaderExecuting(DbCommand, CommandEventData, InterceptionResult<DbDataReader>). In this case, result is the result returned by ReaderExecuting(DbCommand, CommandEventData, InterceptionResult<DbDataReader>).

ReaderExecutedAsync(DbCommand, CommandExecutedEventData, DbDataReader, CancellationToken)

Called immediately after EF calls ExecuteReaderAsync().

This method is still called if an interceptor suppressed execution of a command in ReaderExecutingAsync(DbCommand, CommandEventData, InterceptionResult<DbDataReader>, CancellationToken). In this case, result is the result returned by ReaderExecutingAsync(DbCommand, CommandEventData, InterceptionResult<DbDataReader>, CancellationToken).

ReaderExecuting(DbCommand, CommandEventData, InterceptionResult<DbDataReader>)

Called just before EF intends to call ExecuteReader().

ReaderExecutingAsync(DbCommand, CommandEventData, InterceptionResult<DbDataReader>, CancellationToken)

Called just before EF intends to call ExecuteReaderAsync().

ScalarExecuted(DbCommand, CommandExecutedEventData, Object)

Called immediately after EF calls ExecuteScalar().

This method is still called if an interceptor suppressed execution of a command in ScalarExecuting(DbCommand, CommandEventData, InterceptionResult<Object>). In this case, result is the result returned by ScalarExecuting(DbCommand, CommandEventData, InterceptionResult<Object>).

ScalarExecutedAsync(DbCommand, CommandExecutedEventData, Object, CancellationToken)

Called immediately after EF calls ExecuteScalarAsync().

This method is still called if an interceptor suppressed execution of a command in ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken). In this case, result is the result returned by ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken).

ScalarExecuting(DbCommand, CommandEventData, InterceptionResult<Object>)

Called just before EF intends to call ExecuteScalar().

ScalarExecutingAsync(DbCommand, CommandEventData, InterceptionResult<Object>, CancellationToken)

Called just before EF intends to call ExecuteScalarAsync().

Applies to