共用方式為


RelationalLoggerExtensions.ConnectionErrorAsync 方法

定義

ConnectionError事件的記錄。

public static System.Threading.Tasks.Task ConnectionErrorAsync (this Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger<Microsoft.EntityFrameworkCore.DbLoggerCategory.Database.Connection> diagnostics, Microsoft.EntityFrameworkCore.Storage.IRelationalConnection connection, Exception exception, DateTimeOffset startTime, TimeSpan duration, bool logErrorAsDebug, System.Threading.CancellationToken cancellationToken = default);
static member ConnectionErrorAsync : Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger<Microsoft.EntityFrameworkCore.DbLoggerCategory.Database.Connection> * Microsoft.EntityFrameworkCore.Storage.IRelationalConnection * Exception * DateTimeOffset * TimeSpan * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function ConnectionErrorAsync (diagnostics As IDiagnosticsLogger(Of DbLoggerCategory.Database.Connection), connection As IRelationalConnection, exception As Exception, startTime As DateTimeOffset, duration As TimeSpan, logErrorAsDebug As Boolean, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

diagnostics
IDiagnosticsLogger<DbLoggerCategory.Database.Connection>

要使用的診斷記錄器。

connection
IRelationalConnection

連接。

exception
Exception

表示錯誤的例外狀況。

startTime
DateTimeOffset

作業啟動的時間。

duration
TimeSpan

作業失敗之前的經過時間。

logErrorAsDebug
Boolean

指出正在處理例外狀況的旗標,因此應該記錄在偵錯層級。

cancellationToken
CancellationToken

取消語彙基元。

傳回

Task 表示非同步作業。

適用於