DbCommandInterceptor.ReaderExecutingAsync Methode

Definition

Wird kurz aufgerufen, bevor EF aufzurufen ExecuteReaderAsync()beabsichtigt.

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

Parameter

command
DbCommand

Der Befehl.

eventData
CommandEventData

Kontextbezogene Informationen zum Befehl und zur Ausführung.

result
InterceptionResult<DbDataReader>

Stellt das aktuelle Ergebnis dar, sofern vorhanden. Dieser Wert wird auf true festgelegt, wenn ein vorheriger Interceptor die Ausführung durch Aufrufen SuppressWithResult(TResult)von unterdrückt hatHasResult. Dieser Wert wird in der Regel als Rückgabewert für die Implementierung dieser Methode verwendet.

cancellationToken
CancellationToken

Ein CancellationToken , der beobachtet werden soll, während auf den Abschluss der Aufgabe gewartet wird.

Gibt zurück

Wenn HasResult false ist, wird die EF wie gewohnt fortgesetzt. Wenn HasResult true ist, unterdrückt EF den Vorgang, den es ausführen wollte, und verwendet Result stattdessen. Eine normale Implementierung dieser Methode für jeden Interceptor, der nicht versucht, das Ergebnis zu ändern, besteht darin, den result übergebenen Wert zurückzugeben, häufig mit FromResult<TResult>(TResult)

Implementiert

Ausnahmen

Gilt für: