共用方式為


DbConnectionInterceptor.ConnectionClosingAsync 方法

定義

在 EF 想要在非同步內容中呼叫之前呼叫 CloseAsync()

public virtual System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult> ConnectionClosingAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.ConnectionEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult result);
public virtual System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult> ConnectionClosingAsync (System.Data.Common.DbConnection connection, Microsoft.EntityFrameworkCore.Diagnostics.ConnectionEventData eventData, Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult result);
abstract member ConnectionClosingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.ConnectionEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult>
override this.ConnectionClosingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.ConnectionEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult -> System.Threading.Tasks.Task<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult>
abstract member ConnectionClosingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.ConnectionEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult>
override this.ConnectionClosingAsync : System.Data.Common.DbConnection * Microsoft.EntityFrameworkCore.Diagnostics.ConnectionEventData * Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult -> System.Threading.Tasks.ValueTask<Microsoft.EntityFrameworkCore.Diagnostics.InterceptionResult>
Public Overridable Function ConnectionClosingAsync (connection As DbConnection, eventData As ConnectionEventData, result As InterceptionResult) As Task(Of InterceptionResult)
Public Overridable Function ConnectionClosingAsync (connection As DbConnection, eventData As ConnectionEventData, result As InterceptionResult) As ValueTask(Of InterceptionResult)

參數

connection
DbConnection

連接。

eventData
ConnectionEventData

連線的相關內容資訊。

result
InterceptionResult

如果存在,則表示目前的結果。 如果某些先前的攔截器藉由呼叫 Suppress() 來隱藏執行,這個值將會 IsSuppressed 設定 true 為 。 這個值通常用來作為這個方法實作的傳回值。

傳回

如果 IsSuppressed 為 false,EF 會如常繼續。 如果 IsSuppressed 為 true,EF 將會隱藏即將執行的作業。 任何未嘗試隱藏作業的攔截器,這個方法的一般實作是傳回 result 傳入的值。

實作

適用於