DbCommandInterceptor.CommandCreating Yöntem

Tanım

EF çağrısı yapmadan hemen önce çağrılır 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);
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)

Parametreler

eventData
CommandCorrelatedEventData

Komut ve yürütme hakkında bağlamsal bilgiler.

result
InterceptionResult<DbCommand>

Varsa geçerli sonucu temsil eder. Önceki bir kesme noktası çağrısı SuppressWithResult(TResult)yaparak yürütmeyi engellediyse bu değer HasResult olarak ayarlanırtrue. Bu değer genellikle bu yöntemin uygulanması için dönüş değeri olarak kullanılır.

Döndürülenler

False HasResult ise EF normal şekilde devam eder. True HasResult ise, EF gerçekleştirmek üzere olduğu işlemi bastırır ve bunun yerine kullanır Result . Sonucu değiştirmeye çalışmayan herhangi bir kesme noktası için bu yöntemin normal bir uygulaması geçirilen değeri döndürmektir result .

Uygulamalar

Şunlara uygulanır