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
ILoggingOptionsLogging options.
eventId
EventIdThe EventId.
level
LogLevelThe LogLevel at which the event will be logged.
eventIdCode
stringA string representing the code that should be passed to ConfigureWarnings(Action<WarningsConfigurationBuilder>).
messageFormat
stringThe parameterized message definition.
Properties
MessageFormat
The parameterized message definition.
public virtual string MessageFormat { get; }
Property Value
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
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.