Table of Contents

Class RelationalLoggerExtensions

Namespace
Microsoft.EntityFrameworkCore.Diagnostics
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

This class contains static methods used by EF Core internals and relational database providers to write information to an ILogger and a DiagnosticListener for well-known events.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public static class RelationalLoggerExtensions
Inheritance
RelationalLoggerExtensions
Inherited Members

Methods

AllIndexPropertiesNotToMappedToAnyTable(IDiagnosticsLogger<Validation>, IEntityType, IIndex)

public static void AllIndexPropertiesNotToMappedToAnyTable(this IDiagnosticsLogger<DbLoggerCategory.Model.Validation> diagnostics, IEntityType entityType, IIndex index)

Parameters

diagnostics IDiagnosticsLogger<Validation>

The diagnostics logger to use.

entityType IEntityType

The entity type on which the index is defined.

index IIndex

The index on the entity type.

AmbientTransactionEnlisted(IDiagnosticsLogger<Transaction>, IRelationalConnection, Transaction)

Logs for the AmbientTransactionEnlisted event.

public static void AmbientTransactionEnlisted(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, Transaction transaction)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction Transaction

The transaction.

AmbientTransactionWarning(IDiagnosticsLogger<Transaction>, IRelationalConnection, DateTimeOffset)

Logs for the AmbientTransactionWarning event.

public static void AmbientTransactionWarning(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

BatchExecutorFailedToReleaseSavepoint(IDiagnosticsLogger<Update>, Type, Exception)

public static void BatchExecutorFailedToReleaseSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Update> diagnostics, Type contextType, Exception exception)

Parameters

diagnostics IDiagnosticsLogger<Update>

The diagnostics logger to use.

contextType Type

The Microsoft.EntityFrameworkCore.DbContext type being used.

exception Exception

The exception that caused this failure.

BatchExecutorFailedToRollbackToSavepoint(IDiagnosticsLogger<Update>, Type, Exception)

public static void BatchExecutorFailedToRollbackToSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Update> diagnostics, Type contextType, Exception exception)

Parameters

diagnostics IDiagnosticsLogger<Update>

The diagnostics logger to use.

contextType Type

The Microsoft.EntityFrameworkCore.DbContext type being used.

exception Exception

The exception that caused this failure.

BatchReadyForExecution(IDiagnosticsLogger<Update>, IEnumerable<IUpdateEntry>, int)

Logs for the BatchReadyForExecution event.

public static void BatchReadyForExecution(this IDiagnosticsLogger<DbLoggerCategory.Update> diagnostics, IEnumerable<IUpdateEntry> entries, int commandCount)

Parameters

diagnostics IDiagnosticsLogger<Update>

The diagnostics logger to use.

entries IEnumerable<IUpdateEntry>

The entries for entities in the batch.

commandCount int

The number of commands.

BatchSmallerThanMinBatchSize(IDiagnosticsLogger<Update>, IEnumerable<IUpdateEntry>, int, int)

Logs for the BatchSmallerThanMinBatchSize event.

public static void BatchSmallerThanMinBatchSize(this IDiagnosticsLogger<DbLoggerCategory.Update> diagnostics, IEnumerable<IUpdateEntry> entries, int commandCount, int minBatchSize)

Parameters

diagnostics IDiagnosticsLogger<Update>

The diagnostics logger to use.

entries IEnumerable<IUpdateEntry>

The entries for entities in the batch.

commandCount int

The number of commands.

minBatchSize int

The minimum batch size.

BoolWithDefaultWarning(IDiagnosticsLogger<Validation>, IProperty)

Logs for the BoolWithDefaultWarning event.

public static void BoolWithDefaultWarning(this IDiagnosticsLogger<DbLoggerCategory.Model.Validation> diagnostics, IProperty property)

Parameters

diagnostics IDiagnosticsLogger<Validation>

The diagnostics logger to use.

property IProperty

The property.

CommandCreated(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbCommandMethod, DbContext, Guid, Guid, DateTimeOffset, TimeSpan)

Logs for the CommandCreated event.

public static DbCommand CommandCreated(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbCommandMethod commandMethod, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

commandMethod DbCommandMethod

The type of method that will be called on this command.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command creation.

Returns

DbCommand

An intercepted result.

CommandCreating(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommandMethod, DbContext, Guid, Guid, DateTimeOffset)

Logs for the CommandCreating event.

public static InterceptionResult<DbCommand> CommandCreating(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommandMethod commandMethod, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

commandMethod DbCommandMethod

The type of method that will be called on this command.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

Returns

InterceptionResult<DbCommand>

An intercepted result.

CommandError(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, DbCommandMethod, Guid, Guid, Exception, DateTimeOffset, TimeSpan)

Logs for the CommandError event.

public static void CommandError(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, DbCommandMethod executeMethod, Guid commandId, Guid connectionId, Exception exception, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

The Microsoft.EntityFrameworkCore.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.

CommandErrorAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, DbCommandMethod, Guid, Guid, Exception, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the CommandError event.

public static Task CommandErrorAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, DbCommandMethod executeMethod, Guid commandId, Guid connectionId, Exception exception, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

The Microsoft.EntityFrameworkCore.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

Task

A Task representing the async operation.

CommandNonQueryExecuted(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, int, DateTimeOffset, TimeSpan)

Logs for the CommandExecuted event.

public static int CommandNonQueryExecuted(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, int methodResult, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

methodResult int

The return value from the underlying method execution.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command execution, not including consuming results.

Returns

int

The result of execution, which may have been modified by an interceptor.

CommandNonQueryExecutedAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, int, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the CommandExecuted event.

public static ValueTask<int> CommandNonQueryExecutedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, int methodResult, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

methodResult int

The return value from the underlying method execution.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command execution, not including consuming results.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<int>

The result of execution, which may have been modified by an interceptor.

CommandNonQueryExecuting(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DateTimeOffset)

Logs for the CommandExecuting event.

public static InterceptionResult<int> CommandNonQueryExecuting(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

Returns

InterceptionResult<int>

An intercepted result.

CommandNonQueryExecutingAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DateTimeOffset, CancellationToken)

Logs for the CommandExecuting event.

public static ValueTask<InterceptionResult<int>> CommandNonQueryExecutingAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult<int>>

An intercepted result.

CommandReaderExecuted(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DbDataReader, DateTimeOffset, TimeSpan)

Logs for the CommandExecuted event.

public static DbDataReader CommandReaderExecuted(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DbDataReader methodResult, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

methodResult DbDataReader

The return value from the underlying method execution.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command execution, not including consuming results.

Returns

DbDataReader

The result of execution, which may have been modified by an interceptor.

CommandReaderExecutedAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DbDataReader, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the CommandExecuted event.

public static ValueTask<DbDataReader> CommandReaderExecutedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DbDataReader methodResult, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

methodResult DbDataReader

The return value from the underlying method execution.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command execution, not including consuming results.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<DbDataReader>

The result of execution, which may have been modified by an interceptor.

CommandReaderExecuting(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DateTimeOffset)

Logs for the CommandExecuting event.

public static InterceptionResult<DbDataReader> CommandReaderExecuting(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

Returns

InterceptionResult<DbDataReader>

An intercepted result.

CommandReaderExecutingAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DateTimeOffset, CancellationToken)

Logs for the CommandExecuting event.

public static ValueTask<InterceptionResult<DbDataReader>> CommandReaderExecutingAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult<DbDataReader>>

An intercepted result.

CommandScalarExecuted(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, object, DateTimeOffset, TimeSpan)

Logs for the CommandExecuted event.

public static object CommandScalarExecuted(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, object methodResult, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

methodResult object

The return value from the underlying method execution.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command execution, not including consuming results.

Returns

object

The result of execution, which may have been modified by an interceptor.

CommandScalarExecutedAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, object, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the CommandExecuted event.

public static ValueTask<object> CommandScalarExecutedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, object methodResult, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

methodResult object

The return value from the underlying method execution.

startTime DateTimeOffset

The time that execution began.

duration TimeSpan

The duration of the command execution, not including consuming results.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<object>

The result of execution, which may have been modified by an interceptor.

CommandScalarExecuting(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DateTimeOffset)

Logs for the CommandExecuting event.

public static InterceptionResult<object> CommandScalarExecuting(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

Returns

InterceptionResult<object>

An intercepted result.

CommandScalarExecutingAsync(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbContext, Guid, Guid, DateTimeOffset, CancellationToken)

Logs for the CommandExecuting event.

public static ValueTask<InterceptionResult<object>> CommandScalarExecutingAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbContext context, Guid commandId, Guid connectionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

context DbContext

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

commandId Guid

The correlation ID associated with the given DbCommand.

connectionId Guid

The correlation ID associated with the DbConnection being used.

startTime DateTimeOffset

The time that execution began.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult<object>>

An intercepted result.

ConnectionClosed(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionClosed event.

public static void ConnectionClosed(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The amount of time before the connection was closed.

ConnectionClosedAsync(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionClosed event.

public static Task ConnectionClosedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The amount of time before the connection was closed.

Returns

Task

A Task representing the async operation.

ConnectionClosing(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset)

Logs for the ConnectionClosing event.

public static InterceptionResult ConnectionClosing(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

ConnectionClosingAsync(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset)

Logs for the ConnectionClosing event.

public static ValueTask<InterceptionResult> ConnectionClosingAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

ConnectionError(IDiagnosticsLogger<Connection>, IRelationalConnection, Exception, DateTimeOffset, TimeSpan, bool)

Logs for the ConnectionError event.

public static void ConnectionError(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, Exception exception, DateTimeOffset startTime, TimeSpan duration, bool logErrorAsDebug)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

exception Exception

The exception representing the error.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time before the operation failed.

logErrorAsDebug bool

A flag indicating the exception is being handled and so it should be logged at Debug level.

ConnectionErrorAsync(IDiagnosticsLogger<Connection>, IRelationalConnection, Exception, DateTimeOffset, TimeSpan, bool, CancellationToken)

Logs for the ConnectionError event.

public static Task ConnectionErrorAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, Exception exception, DateTimeOffset startTime, TimeSpan duration, bool logErrorAsDebug, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

exception Exception

The exception representing the error.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time before the operation failed.

logErrorAsDebug bool

A flag indicating the exception is being handled and so it should be logged at Debug level.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

ConnectionOpened(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset, TimeSpan)

Logs for the ConnectionOpened event.

public static void ConnectionOpened(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The amount of time before the connection was opened.

ConnectionOpenedAsync(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the ConnectionOpened event.

public static Task ConnectionOpenedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The amount of time before the connection was opened.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

ConnectionOpening(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset)

Logs for the ConnectionOpening event.

public static InterceptionResult ConnectionOpening(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

ConnectionOpeningAsync(IDiagnosticsLogger<Connection>, IRelationalConnection, DateTimeOffset, CancellationToken)

Logs for the ConnectionOpening event.

public static ValueTask<InterceptionResult> ConnectionOpeningAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Connection> diagnostics, IRelationalConnection connection, DateTimeOffset startTime, CancellationToken cancellationToken)

Parameters

diagnostics IDiagnosticsLogger<Connection>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

CreatedTransactionSavepoint(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the CreatedTransactionSavepoint event.

public static void CreatedTransactionSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

CreatedTransactionSavepointAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the CreatedTransactionSavepoint event.

public static Task CreatedTransactionSavepointAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

CreatingTransactionSavepoint(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the CreatingTransactionSavepoint event.

public static InterceptionResult CreatingTransactionSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

CreatingTransactionSavepointAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the CreatingTransactionSavepoint event.

public static ValueTask<InterceptionResult> CreatingTransactionSavepointAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

DataReaderDisposing(IDiagnosticsLogger<Command>, IRelationalConnection, DbCommand, DbDataReader, Guid, int, int, DateTimeOffset, TimeSpan)

Logs for the DataReaderDisposing event.

public static InterceptionResult DataReaderDisposing(this IDiagnosticsLogger<DbLoggerCategory.Database.Command> diagnostics, IRelationalConnection connection, DbCommand command, DbDataReader dataReader, Guid commandId, int recordsAffected, int readCount, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Command>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

command DbCommand

The database command object.

dataReader DbDataReader

The data reader.

commandId Guid

The correlation ID associated with the given DbCommand.

recordsAffected int

The number of records in the database that were affected.

readCount int

The number of records that were read.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

ExplicitTransactionEnlisted(IDiagnosticsLogger<Transaction>, IRelationalConnection, Transaction)

Logs for the ExplicitTransactionEnlisted event.

public static void ExplicitTransactionEnlisted(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, Transaction transaction)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction Transaction

The transaction.

ForeignKeyPropertiesMappedToUnrelatedTables(IDiagnosticsLogger<Validation>, IForeignKey)

public static void ForeignKeyPropertiesMappedToUnrelatedTables(this IDiagnosticsLogger<DbLoggerCategory.Model.Validation> diagnostics, IForeignKey foreignKey)

Parameters

diagnostics IDiagnosticsLogger<Validation>

The diagnostics logger to use.

foreignKey IForeignKey

The foreign key.

IndexPropertiesBothMappedAndNotMappedToTable(IDiagnosticsLogger<Validation>, IEntityType, IIndex, string)

public static void IndexPropertiesBothMappedAndNotMappedToTable(this IDiagnosticsLogger<DbLoggerCategory.Model.Validation> diagnostics, IEntityType entityType, IIndex index, string unmappedPropertyName)

Parameters

diagnostics IDiagnosticsLogger<Validation>

The diagnostics logger to use.

entityType IEntityType

The entity type on which the index is defined.

index IIndex

The index on the entity type.

unmappedPropertyName string

The name of the property which is not mapped.

IndexPropertiesMappedToNonOverlappingTables(IDiagnosticsLogger<Validation>, IEntityType, IIndex, string, List<(string Table, string Schema)>, string, List<(string Table, string Schema)>)

public static void IndexPropertiesMappedToNonOverlappingTables(this IDiagnosticsLogger<DbLoggerCategory.Model.Validation> diagnostics, IEntityType entityType, IIndex index, string property1Name, List<(string Table, string Schema)> tablesMappedToProperty1, string property2Name, List<(string Table, string Schema)> tablesMappedToProperty2)

Parameters

diagnostics IDiagnosticsLogger<Validation>

The diagnostics logger to use.

entityType IEntityType

The entity type on which the index is defined.

index IIndex

The index on the entity type.

property1Name string

The first property name which is invalid.

tablesMappedToProperty1 List<(string Table, string Schema)>

The tables mapped to the first property.

property2Name string

The second property name which is invalid.

tablesMappedToProperty2 List<(string Table, string Schema)>

The tables mapped to the second property.

MigrateUsingConnection(IDiagnosticsLogger<Migrations>, IMigrator, IRelationalConnection)

Logs for the MigrateUsingConnection event.

public static void MigrateUsingConnection(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator, IRelationalConnection connection)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

connection IRelationalConnection

The connection.

MigrationApplying(IDiagnosticsLogger<Migrations>, IMigrator, Migration)

Logs for the MigrationApplying event.

public static void MigrationApplying(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator, Migration migration)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

migration Migration

The migration.

MigrationAttributeMissingWarning(IDiagnosticsLogger<Migrations>, TypeInfo)

public static void MigrationAttributeMissingWarning(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, TypeInfo migrationType)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrationType TypeInfo

Info for the migration type.

MigrationGeneratingDownScript(IDiagnosticsLogger<Migrations>, IMigrator, Migration, string, string, bool)

Logs for the MigrationGeneratingDownScript event.

public static void MigrationGeneratingDownScript(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator, Migration migration, string fromMigration, string toMigration, bool idempotent)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

migration Migration

The migration.

fromMigration string

The starting migration name.

toMigration string

The ending migration name.

idempotent bool

Indicates whether or not an idempotent script is being generated.

MigrationGeneratingUpScript(IDiagnosticsLogger<Migrations>, IMigrator, Migration, string, string, bool)

Logs for the MigrationGeneratingUpScript event.

public static void MigrationGeneratingUpScript(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator, Migration migration, string fromMigration, string toMigration, bool idempotent)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

migration Migration

The migration.

fromMigration string

The starting migration name.

toMigration string

The ending migration name.

idempotent bool

Indicates whether or not an idempotent script is being generated.

MigrationReverting(IDiagnosticsLogger<Migrations>, IMigrator, Migration)

Logs for the MigrationReverting event.

public static void MigrationReverting(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator, Migration migration)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

migration Migration

The migration.

MigrationsNotApplied(IDiagnosticsLogger<Migrations>, IMigrator)

Logs for the MigrationsNotApplied event.

public static void MigrationsNotApplied(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

MigrationsNotFound(IDiagnosticsLogger<Migrations>, IMigrator, IMigrationsAssembly)

Logs for the MigrationsNotFound event.

public static void MigrationsNotFound(this IDiagnosticsLogger<DbLoggerCategory.Migrations> diagnostics, IMigrator migrator, IMigrationsAssembly migrationsAssembly)

Parameters

diagnostics IDiagnosticsLogger<Migrations>

The diagnostics logger to use.

migrator IMigrator

The migrator.

migrationsAssembly IMigrationsAssembly

The assembly in which migrations are stored.

ModelValidationKeyDefaultValueWarning(IDiagnosticsLogger<Validation>, IProperty)

public static void ModelValidationKeyDefaultValueWarning(this IDiagnosticsLogger<DbLoggerCategory.Model.Validation> diagnostics, IProperty property)

Parameters

diagnostics IDiagnosticsLogger<Validation>

The diagnostics logger to use.

property IProperty

The property.

MultipleCollectionIncludeWarning(IDiagnosticsLogger<Query>)

public static void MultipleCollectionIncludeWarning(this IDiagnosticsLogger<DbLoggerCategory.Query> diagnostics)

Parameters

diagnostics IDiagnosticsLogger<Query>

The diagnostics logger to use.

QueryPossibleExceptionWithAggregateOperatorWarning(IDiagnosticsLogger<Query>)

[Obsolete]
public static void QueryPossibleExceptionWithAggregateOperatorWarning(this IDiagnosticsLogger<DbLoggerCategory.Query> diagnostics)

Parameters

diagnostics IDiagnosticsLogger<Query>

The diagnostics logger to use.

QueryPossibleUnintendedUseOfEqualsWarning(IDiagnosticsLogger<Query>, SqlExpression, SqlExpression)

public static void QueryPossibleUnintendedUseOfEqualsWarning(this IDiagnosticsLogger<DbLoggerCategory.Query> diagnostics, SqlExpression left, SqlExpression right)

Parameters

diagnostics IDiagnosticsLogger<Query>

The diagnostics logger to use.

left SqlExpression

The left SQL expression of the Equals.

right SqlExpression

The right SQL expression of the Equals.

ReleasedTransactionSavepoint(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the ReleasedTransactionSavepoint event.

public static void ReleasedTransactionSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

ReleasedTransactionSavepointAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the ReleasedTransactionSavepoint event.

public static Task ReleasedTransactionSavepointAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

ReleasingTransactionSavepoint(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

public static InterceptionResult ReleasingTransactionSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

ReleasingTransactionSavepointAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the ReleasingTransactionSavepoint event.

public static ValueTask<InterceptionResult> ReleasingTransactionSavepointAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

RolledBackToTransactionSavepoint(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

public static void RolledBackToTransactionSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

RolledBackToTransactionSavepointAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the CreatedTransactionSavepoint event.

public static Task RolledBackToTransactionSavepointAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

RollingBackToTransactionSavepoint(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

public static InterceptionResult RollingBackToTransactionSavepoint(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

RollingBackToTransactionSavepointAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

public static ValueTask<InterceptionResult> RollingBackToTransactionSavepointAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

TransactionCommitted(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, TimeSpan)

Logs for the TransactionCommitted event.

public static void TransactionCommitted(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

TransactionCommittedAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the TransactionCommitted event.

public static Task TransactionCommittedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

TransactionCommitting(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the TransactionCommitting event.

public static InterceptionResult TransactionCommitting(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

TransactionCommittingAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the TransactionCommitting event.

public static ValueTask<InterceptionResult> TransactionCommittingAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

TransactionDisposed(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the TransactionDisposed event.

public static void TransactionDisposed(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

TransactionError(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, string, Exception, DateTimeOffset, TimeSpan)

Logs for the TransactionError event.

public static void TransactionError(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, string action, Exception exception, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

action string

The action being taken.

exception Exception

The exception that represents the error.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

TransactionErrorAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, string, Exception, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the TransactionError event.

public static Task TransactionErrorAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, string action, Exception exception, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

action string

The action being taken.

exception Exception

The exception that represents the error.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

TransactionRolledBack(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, TimeSpan)

Logs for the TransactionRolledBack event.

public static void TransactionRolledBack(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

TransactionRolledBackAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the TransactionRolledBack event.

public static Task TransactionRolledBackAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The elapsed time from when the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task representing the async operation.

TransactionRollingBack(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the TransactionRollingBack event.

public static InterceptionResult TransactionRollingBack(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult

The result of execution, which may have been modified by an interceptor.

TransactionRollingBackAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the TransactionRollingBack event.

public static ValueTask<InterceptionResult> TransactionRollingBackAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult>

A Task representing the async operation.

TransactionStarted(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, TimeSpan)

Logs for the TransactionStarted event.

public static DbTransaction TransactionStarted(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, TimeSpan duration)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The amount of time before the connection was opened.

Returns

DbTransaction

The result of execution, which may have been modified by an interceptor.

TransactionStartedAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, TimeSpan, CancellationToken)

Logs for the TransactionStarted event.

public static ValueTask<DbTransaction> TransactionStartedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, TimeSpan duration, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

duration TimeSpan

The amount of time before the connection was opened.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<DbTransaction>

The result of execution, which may have been modified by an interceptor.

TransactionStarting(IDiagnosticsLogger<Transaction>, IRelationalConnection, IsolationLevel, Guid, DateTimeOffset)

Logs for the TransactionStarting event.

public static InterceptionResult<DbTransaction> TransactionStarting(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, IsolationLevel isolationLevel, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

isolationLevel IsolationLevel

The transaction isolation level.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

InterceptionResult<DbTransaction>

The result of execution, which may have been modified by an interceptor.

TransactionStartingAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, IsolationLevel, Guid, DateTimeOffset, CancellationToken)

Logs for the TransactionStarting event.

public static ValueTask<InterceptionResult<DbTransaction>> TransactionStartingAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, IsolationLevel isolationLevel, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

isolationLevel IsolationLevel

The transaction isolation level.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<InterceptionResult<DbTransaction>>

The result of execution, which may have been modified by an interceptor.

TransactionUsed(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset)

Logs for the TransactionUsed event.

public static DbTransaction TransactionUsed(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

Returns

DbTransaction

The result of execution, which may have been modified by an interceptor.

TransactionUsedAsync(IDiagnosticsLogger<Transaction>, IRelationalConnection, DbTransaction, Guid, DateTimeOffset, CancellationToken)

Logs for the TransactionUsed event.

public static ValueTask<DbTransaction> TransactionUsedAsync(this IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> diagnostics, IRelationalConnection connection, DbTransaction transaction, Guid transactionId, DateTimeOffset startTime, CancellationToken cancellationToken = default)

Parameters

diagnostics IDiagnosticsLogger<Transaction>

The diagnostics logger to use.

connection IRelationalConnection

The connection.

transaction DbTransaction

The transaction.

transactionId Guid

The correlation ID associated with the DbTransaction.

startTime DateTimeOffset

The time that the operation was started.

cancellationToken CancellationToken

The cancellation token.

Returns

ValueTask<DbTransaction>

The result of execution, which may have been modified by an interceptor.