語言

EventDefinition<TParam> 類別

定義

定義事件的元資料,包含一個參數及快取代理,用以減少配置記錄事件。

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

類型參數

TParam
繼承
EventDefinition<TParam>
屬性

備註

更多資訊與範例請參見 資料庫提供者與擴充功能的實作 。

建構函式

名稱 Description
EventDefinition<TParam>(EventId, LogLevel, Action<ILogger,TParam,Exception>)

建立一個事件定義實例。

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

建立一個事件定義實例。

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

建立一個事件定義實例。

屬性

名稱 Description
EventId

EventId。

(繼承來源 EventDefinitionBase)
EventIdCode

一個字串代表應該傳遞的 ConfigureWarnings(Action<WarningsConfigurationBuilder>) 程式碼,以抑制此事件的錯誤。

(繼承來源 EventDefinitionBase)
Level

LogLevel該活動將被記錄。

(繼承來源 EventDefinitionBase)
WarningBehavior

已配置 WarningBehavior的 .

(繼承來源 EventDefinitionBase)

方法

名稱 Description
GenerateMessage(TParam, Exception)

產生本來要記錄的訊息,但不會記錄。 通常用於在錯誤警告的情況下拋出例外。

GenerateMessage(TParam)

產生本來要記錄的訊息,但不會記錄。 通常用於在錯誤警告的情況下拋出例外。

GetLogBehavior<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>)

取得此事件的日誌行為。 這決定了是否應該記錄、拋出為例外或忽略。

(繼承來源 EventDefinitionBase)
Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, TParam, Exception)
已淘汰.

記錄事件,或在事件被設定為錯誤時拋出。

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, TParam)

記錄事件,或在事件被設定為錯誤時拋出。

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, WarningBehavior, TParam, Exception)

記錄事件,或在事件被設定為錯誤時拋出。

Log<TLoggerCategory>(IDiagnosticsLogger<TLoggerCategory>, WarningBehavior, TParam)

記錄事件,或在事件被設定為錯誤時拋出。

WarningAsError(String)

回傳一個警告為錯誤的例外,將該事件封裝給定訊息。

(繼承來源 EventDefinitionBase)

適用於