Langue

IDbCommandInterceptor Interface

Définition

Autorise l’interception des commandes envoyées à une base de données relationnelle.

public interface IDbCommandInterceptor : Microsoft.EntityFrameworkCore.Diagnostics.IInterceptor
type IDbCommandInterceptor = interface
    interface IInterceptor
Public Interface IDbCommandInterceptor
Implements IInterceptor
Dérivé
Implémente

Remarques

Les intercepteurs de commandes peuvent être utilisés pour afficher, modifier ou supprimer l’exécution du DbCommand, et pour modifier le résultat avant son retour à EF.

Envisagez d’hériter s’il DbCommandInterceptor n’implémente pas toutes les méthodes.

Permet AddInterceptors(IInterceptor[]) d’inscrire des intercepteurs d’application.

Les extensions peuvent également inscrire des intercepteurs dans le fournisseur de services interne. Si les intercepteurs injectés et d’application sont trouvés, les intercepteurs injectés sont exécutés dans l’ordre dans lequel ils sont résolus à partir du fournisseur de services, puis les intercepteurs d’application sont exécutés en dernier.

Pour plus d’informations et d’exemples, consultez les intercepteurs EF Core .

Méthodes

Nom Description
CommandCanceled(DbCommand, CommandEndEventData)

Appelé lorsqu’une commande a été annulée.

CommandCanceledAsync(DbCommand, CommandEndEventData, CancellationToken)

Appelé lorsqu’une commande a été annulée.

CommandCreated(CommandEndEventData, DbCommand)

Appelé immédiatement après les appels CreateCommand()EF .

CommandCreating(CommandCorrelatedEventData, InterceptionResult<DbCommand>)

Appelé juste avant qu’EF ait l’intention d’appeler CreateCommand().

CommandFailed(DbCommand, CommandErrorEventData)

Appelé lorsque l’exécution d’une commande a échoué avec une exception.

CommandFailedAsync(DbCommand, CommandErrorEventData, CancellationToken)

Appelé lorsque l’exécution d’une commande a échoué avec une exception.

CommandInitialized(CommandEndEventData, DbCommand)

Appelé après l’initialisation CommandText d’EF et d’autres configurations de commandes.

DataReaderClosing(DbCommand, DataReaderClosingEventData, InterceptionResult)

Appelé juste avant qu’EF ait l’intention d’appeler Close().

DataReaderClosingAsync(DbCommand, DataReaderClosingEventData, InterceptionResult)

Appelé juste avant qu’EF ait l’intention d’appeler CloseAsync() dans un contexte asynchrone.

DataReaderDisposing(DbCommand, DataReaderDisposingEventData, InterceptionResult)

Appelé quand l’exécution d’un DbDataReader est sur le point d’être supprimée.

NonQueryExecuted(DbCommand, CommandExecutedEventData, Int32)

Appelé immédiatement après les appels ExecuteNonQuery()EF .

NonQueryExecutedAsync(DbCommand, CommandExecutedEventData, Int32, CancellationToken)

Appelé immédiatement après les appels ExecuteNonQueryAsync()EF .

NonQueryExecuting(DbCommand, CommandEventData, InterceptionResult<Int32>)

Appelé juste avant qu’EF ait l’intention d’appeler ExecuteNonQuery().

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

Appelé juste avant qu’EF ait l’intention d’appeler ExecuteNonQueryAsync().

ReaderExecuted(DbCommand, CommandExecutedEventData, DbDataReader)

Appelé immédiatement après les appels ExecuteReader()EF .

ReaderExecutedAsync(DbCommand, CommandExecutedEventData, DbDataReader, CancellationToken)

Appelé immédiatement après les appels ExecuteReaderAsync()EF .

ReaderExecuting(DbCommand, CommandEventData, InterceptionResult<DbDataReader>)

Appelé juste avant qu’EF ait l’intention d’appeler ExecuteReader().

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

Appelé juste avant qu’EF ait l’intention d’appeler ExecuteReaderAsync().

ScalarExecuted(DbCommand, CommandExecutedEventData, Object)

Appelé immédiatement après les appels ExecuteScalar()EF .

ScalarExecutedAsync(DbCommand, CommandExecutedEventData, Object, CancellationToken)

Appelé immédiatement après les appels ExecuteScalarAsync()EF .

ScalarExecuting(DbCommand, CommandEventData, InterceptionResult<Object>)

Appelé juste avant qu’EF ait l’intention d’appeler ExecuteScalar().

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

Appelé juste avant qu’EF ait l’intention d’appeler ExecuteScalarAsync().

S’applique à