IDbCommandInterceptor.CommandCreating Metoda

Definicja

Nazwana tuż przed tym, jak EF zamierza wywołać metodę CreateCommand().

public Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> CommandCreating (Microsoft.EntityFrameworkCore.Diagnostics.CommandCorrelatedEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbCommand> result);
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>
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 Function CommandCreating (eventData As CommandCorrelatedEventData, result As InterceptionResult(Of DbCommand)) As InterceptionResult(Of 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 ustawioną wartość true , jeśli jakiś poprzedni przechwytujący pominął wykonywanie przez wywołanie metody SuppressWithResult(TResult). Ta wartość jest zwykle używana jako wartość zwracana dla implementacji tej metody.

Zwraca

Jeśli HasResult jest to fałsz, ef będzie nadal działać normalnie. Jeśli HasResult ma wartość true, program EF pominie operację, która miała wykonać i użyć Result . Implementacja tej metody dla dowolnego przechwytywania, który nie próbuje zmienić wyniku, jest zwrócenie przekazanej result wartości.

Dotyczy