Jazyk

DbCommandInterceptor.NonQueryExecutingAsync Metoda

Definice

Volal těsně před EF hodlá volat ExecuteNonQueryAsync().

public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>> NonQueryExecutingAsync(System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default);
public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>> NonQueryExecutingAsync(System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> result, System.Threading.CancellationToken cancellationToken = default);
abstract member NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
override this.NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
abstract member NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
override this.NonQueryExecutingAsync : System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.Diagnostics.CommandEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<int>>
Public Overridable Function NonQueryExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of InterceptionResult(Of Integer))
Public Overridable Function NonQueryExecutingAsync (command As DbCommand, eventData As CommandEventData, result As InterceptionResult(Of Integer), Optional cancellationToken As CancellationToken = Nothing) As Task(Of InterceptionResult(Of Integer))

Parametry

command
DbCommand

Příkaz.

eventData
CommandEventData

Kontextové informace o příkazu a spuštění

result
InterceptionResult<Int32>

Představuje aktuální výsledek, pokud existuje. Tato hodnota bude nastavena HasResult , true pokud některé předchozí zachytávání potlačí provádění voláním SuppressWithResult(TResult). Tato hodnota se obvykle používá jako návratová hodnota pro implementaci této metody.

cancellationToken
CancellationToken

A CancellationToken , která se má sledovat při čekání na dokončení úkolu.

Návraty

Pokud HasResult je hodnota false, ef bude pokračovat v normálním stavu. Pokud HasResult je pravda, ef potlačí operaci, kterou se chystá provést a použít Result . Normální implementací této metody pro jakýkoli průsečík, který se nepokouší změnit výsledek, je vrátit result hodnotu předanou, často pomocí FromResult<TResult>(TResult)

Implementuje

Výjimky

Platí pro