IDbConnectionInterceptor.ConnectionCreating Yöntem

Tanım

EF bir oluşturmadan hemen önce çağrılır DbConnection. Uygulama kullanılacak bağlantıyı sağlıyorsa bu olay tetiklenmez.

public virtual Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> ConnectionCreating (Microsoft.EntityFrameworkCore.Diagnostics.ConnectionCreatingEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> result);
abstract member ConnectionCreating : Microsoft.EntityFrameworkCore.Diagnostics.ConnectionCreatingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection>
override this.ConnectionCreating : Microsoft.EntityFrameworkCore.Diagnostics.ConnectionCreatingEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection> -> Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult<System.Data.Common.DbConnection>
Public Overridable Function ConnectionCreating (eventData As ConnectionCreatingEventData, result As InterceptionResult(Of DbConnection)) As InterceptionResult(Of DbConnection)

Parametreler

eventData
ConnectionCreatingEventData

Bağlantı hakkında bağlamsal bilgiler.

result
InterceptionResult<DbConnection>

Varsa geçerli sonucu temsil eder. Önceki bir kesme noktası tarafından çağrılarak trueSuppressWithResult(TResult)yürütme engellendiyse bu değer HasResult olarak ayarlanır. Bu değer genellikle bu yöntemin uygulanması için dönüş değeri olarak kullanılır.

Döndürülenler

ise HasResultfalseEF normal şekilde devam eder. ise HasResulttrueEF, gerçekleştirmek üzere olduğu işlemi gizler ve bunun yerine kullanır Result . Sonucu değiştirmeye çalışmayan herhangi bir kesme noktası için bu yöntemin uygulanması geçirilen değeri döndürmelidir result .

Şunlara uygulanır