Język

DbCommandInterceptor.CommandCreating Metoda

Definicja

Wywołana tuż przed rozpoczęciem wywołania programu CreateCommand()EF .

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);
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>
Public Overridable Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of DbCommand)

Parametry

eventData
CommandCorrelatedEventData

Kontekstowe informacje o poleceniu i wykonaniu.

result
InterceptionResult<DbCommand>

Reprezentuje bieżący wynik, jeśli istnieje. Ta wartość będzie miała HasResult wartość , true jeśli niektóre poprzednie przechwytujące operacje pomijane przez wywołanie metody SuppressWithResult(TResult). Ta wartość jest zwykle używana jako wartość zwracana dla implementacji tej metody.

Zwraca

Jeśli HasResult wartość jest fałsz, program EF będzie kontynuowany w normalny sposób. Jeśli HasResult ma wartość true, program EF będzie pomijać operację, która miała wykonać i użyć zamiast tego Result . Normalną implementacją tej metody dla każdego przechwytnika, który nie próbuje zmienić wyniku, jest zwrócenie przekazanej result wartości.

Implementuje

Dotyczy