語言

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>
屬性

備註

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

建構函式

名稱 Description
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>>)

建立一個事件定義實例。

屬性

名稱 Description
EventId

EventId。

(繼承來源 EventDefinitionBase)
EventIdCode

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

(繼承來源 EventDefinitionBase)
Level

LogLevel該活動將被記錄。

(繼承來源 EventDefinitionBase)
WarningBehavior

已配置 WarningBehavior的 .

(繼承來源 EventDefinitionBase)

方法

名稱 Description
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)

適用於