Table of Contents

Class FallbackEventDefinition

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

Defines metadata for an event with more than six parameters such that it has to have special handling.

public class FallbackEventDefinition : EventDefinitionBase
Inheritance
FallbackEventDefinition
Inherited Members

Remarks

See Implementation of database providers and extensions for more information and examples.

Constructors

FallbackEventDefinition(ILoggingOptions, EventId, LogLevel, string, string)

Creates an event definition instance.

public FallbackEventDefinition(ILoggingOptions loggingOptions, EventId eventId, LogLevel level, string eventIdCode, string messageFormat)

Parameters

loggingOptions ILoggingOptions

Logging options.

eventId EventId

The EventId.

level LogLevel

The LogLevel at which the event will be logged.

eventIdCode string

A string representing the code that should be passed to ConfigureWarnings(Action<WarningsConfigurationBuilder>).

messageFormat string

The parameterized message definition.

Properties

MessageFormat

The parameterized message definition.

public virtual string MessageFormat { get; }

Property Value

string

Methods

GenerateMessage(Action<ILogger>)

Generates the message that would be logged without logging it. Typically used for throwing an exception in warning-as-error cases.

public virtual string GenerateMessage(Action<ILogger> logAction)

Parameters

logAction Action<ILogger>

A delegate that will log the message to an ILogger.

Returns

string

The message string.

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, Action<ILogger>)

Logs the event, or throws if the event has been configured to be treated as an error.

public virtual void Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory> logger, Action<ILogger> logAction) where TLoggerCategory : LoggerCategory<TLoggerCategory>, new()

Parameters

logger IDiagnosticsLogger<TLoggerCategory>

The logger to which the event should be logged.

logAction Action<ILogger>

A delegate that will log the message to an ILogger.

Type Parameters

TLoggerCategory

The DbLoggerCategory.