Langue

IDbCommandInterceptor.CommandCreating Méthode

Définition

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

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> CommandCreating(Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> result);
public Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> CommandCreating(Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> result);
abstract member CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
override this.CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
abstract member CommandCreating : Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand>
Public Overridable Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of DbCommand)
Public Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of DbCommand)

Paramètres

eventData
CommandCorrelatedEventData

Informations contextuelles sur la commande et l’exécution.

result
InterceptionResult<DbCommand>

Représente le résultat actuel s’il en existe un. Cette valeur a HasResult la valeur si true un intercepteur précédent a supprimé l’exécution en appelant SuppressWithResult(TResult). Cette valeur est généralement utilisée comme valeur de retour pour l’implémentation de cette méthode.

Retours

Si HasResult la valeur est false, l’EF continuera normalement. Si HasResult c’est vrai, EF supprime l’opération qu’il était sur le point d’effectuer et d’utiliser Result à la place. Une implémentation de cette méthode pour tout intercepteur qui ne tente pas de modifier le résultat consiste à retourner la result valeur passée.

S’applique à