RelationalLoggerExtensions.CommandErrorAsync Method

Definition

Logs for the CommandError event.

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

Parameters

diagnostics
IDiagnosticsLogger<DbLoggerCategory.Database.Command>

The diagnostics logger to use.

connection
IRelationalConnection

The connection.

command
DbCommand

The database command object.

context
DbContext

The DbContext currently being used, to null if not known.

executeMethod
DbCommandMethod

Represents the method that will be called to execute the command.

commandId
Guid

The correlation ID associated with the given DbCommand.

connectionId
Guid

The correlation ID associated with the DbConnection being used.

exception
Exception

The exception that caused this failure.

startTime
DateTimeOffset

The time that execution began.

duration
TimeSpan

The amount of time that passed until the exception was raised.

cancellationToken
CancellationToken

The cancellation token.

Returns

A Task representing the async operation.

Applies to