语言

EventDefinition<TParam1,TParam2> 类

定义

定义具有三个参数的事件的元数据,以及一个缓存委托,以使用减少的分配记录事件。

[System.Runtime.CompilerServices.Nullable(0)]
public class EventDefinition<TParam1,TParam2> : Microsoft.EntityFrameworkCore.Diagnostics.EventDefinitionBase
public class EventDefinition<TParam1,TParam2> : Microsoft.EntityFrameworkCore.Diagnostics.EventDefinitionBase
[<System.Runtime.CompilerServices.Nullable(0)>]
type EventDefinition<'TParam1, 'TParam2> = class
    inherit EventDefinitionBase
type EventDefinition<'TParam1, 'TParam2> = class
    inherit EventDefinitionBase
Public Class EventDefinition(Of TParam1, TParam2)
Inherits EventDefinitionBase

类型参数

TParam1
TParam2
继承
EventDefinition<TParam1,TParam2>
特性

注解

有关详细信息和示例,请参阅 数据库提供程序和扩展的实现 。

构造函数

名称 说明
EventDefinition<TParam1,TParam2>(EventId, LogLevel, Action<ILogger,TParam1,TParam2,Exception>)

创建事件定义实例。

EventDefinition<TParam1,TParam2>(EventId, LogLevel, String, Action<ILogger,TParam1,TParam2,Exception>)

创建事件定义实例。

EventDefinition<TParam1,TParam2>(ILoggingOptions, EventId, LogLevel, String, Func<LogLevel,Action<ILogger,TParam1,TParam2,Exception>>)

创建事件定义实例。

属性

名称 说明
EventId

EventId。

(继承自 EventDefinitionBase)
EventIdCode

一个字符串,表示应传递给 ConfigureWarnings(Action<WarningsConfigurationBuilder>) 以禁止此事件为错误的代码。

(继承自 EventDefinitionBase)
Level

LogLevel将记录事件的位置。

(继承自 EventDefinitionBase)
WarningBehavior

配置的 WarningBehavior。

(继承自 EventDefinitionBase)

方法

名称 说明
GenerateMessage(TParam1, TParam2, Exception)

生成将在不记录的情况下记录的消息。 通常用于在警告为错误案例中引发异常。

GenerateMessage(TParam1, TParam2)

生成将在不记录的情况下记录的消息。 通常用于在警告为错误案例中引发异常。

GetLogBehavior<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>)

获取此事件的日志行为。 这确定是应记录、作为异常引发还是被忽略。

(继承自 EventDefinitionBase)
Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, TParam1, TParam2, Exception)
已过时.

记录事件,或者如果事件配置为被视为错误,则引发该事件。

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, TParam1, TParam2)

记录事件,或者如果事件配置为被视为错误,则引发该事件。

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, WarningBehavior, TParam1, TParam2, Exception)

记录事件,或者如果事件配置为被视为错误,则引发该事件。

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, WarningBehavior, TParam1, TParam2)

记录事件,或者如果事件配置为被视为错误,则引发该事件。

WarningAsError(String)

返回一个警告错误异常,该异常包装此事件的给定消息。

(继承自 EventDefinitionBase)

适用于