共用方式為


RelationalLoggerExtensions.CommandErrorAsync 方法

定義

CommandError事件的記錄。

public static System.Threading.Tasks.Task CommandErrorAsync (this Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger<Microsoft.EntityFrameworkCore.DbLoggerCategory.Database.Command> diagnostics, Microsoft.EntityFrameworkCore.Storage.IRelationalConnection connection, System.Data.Common.DbCommand command, Microsoft.EntityFrameworkCore.DbContext context, Microsoft.EntityFrameworkCore.Diagnostics.DbCommandMethod executeMethod, Guid commandId, Guid connectionId, Exception exception, DateTimeOffset startTime, TimeSpan duration, System.Threading.CancellationToken cancellationToken = default);
static member CommandErrorAsync : Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger<Microsoft.EntityFrameworkCore.DbLoggerCategory.Database.Command> * Microsoft.EntityFrameworkCore.Storage.IRelationalConnection * System.Data.Common.DbCommand * Microsoft.EntityFrameworkCore.DbContext * Microsoft.EntityFrameworkCore.Diagnostics.DbCommandMethod * Guid * Guid * Exception * DateTimeOffset * TimeSpan * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function CommandErrorAsync (diagnostics As IDiagnosticsLogger(Of DbLoggerCategory.Database.Command), connection As IRelationalConnection, command As DbCommand, context As DbContext, executeMethod As DbCommandMethod, commandId As Guid, connectionId As Guid, exception As Exception, startTime As DateTimeOffset, duration As TimeSpan, Optional cancellationToken As CancellationToken = Nothing) As Task

參數

diagnostics
IDiagnosticsLogger<DbLoggerCategory.Database.Command>

要使用的診斷記錄器。

connection
IRelationalConnection

連接。

command
DbCommand

資料庫命令物件。

context
DbContext

DbContext目前使用的 ,如果不知道,則為 null。

executeMethod
DbCommandMethod

表示將呼叫以執行命令的方法。

commandId
Guid

與指定 DbCommand 相關聯的相互關聯識別碼。

connectionId
Guid

DbConnection 所使用 關聯的相互關聯識別碼。

exception
Exception

造成此失敗的例外狀況。

startTime
DateTimeOffset

開始執行的時間。

duration
TimeSpan

在引發例外狀況之前所經過的時間量。

cancellationToken
CancellationToken

取消語彙基元。

傳回

Task 表示非同步作業。

適用於