Share via


RuleSettings 建構函式

定義

初始化 RuleSettings 類別的新執行個體。

多載

RuleSettings(String, String, String)

使用預設值初始化 RuleSettings 類別的新執行個體,不過,名稱、事件名稱及提供者都是指定的。

RuleSettings(String, String, String, String, Int32, Int32, TimeSpan)

初始化 RuleSettings 類別的新執行個體,其中除了 Custom 類別的值以外,所有的值都是指定的。

RuleSettings(String, String, String, String, Int32, Int32, TimeSpan, String)

初始化 BufferModeSettings 類別的新執行個體,其中值是指定的。

RuleSettings(String, String, String)

使用預設值初始化 RuleSettings 類別的新執行個體,不過,名稱、事件名稱及提供者都是指定的。

public:
 RuleSettings(System::String ^ name, System::String ^ eventName, System::String ^ provider);
public RuleSettings (string name, string eventName, string provider);
new System.Web.Configuration.RuleSettings : string * string * string -> System.Web.Configuration.RuleSettings
Public Sub New (name As String, eventName As String, provider As String)

參數

name
String

要建立的 RuleSettings 物件名稱。

eventName
String

適用這項規則的 EventMappingSettings 物件名稱。

provider
String

適用這項規則的 ProviderSettings 物件名稱。

範例

下列程式碼範例示範如何使用 建 RuleSettings 構函式。 此程式碼範例是針對 類別提供的較大範例的 HealthMonitoringSection 一部分。

// Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("All Errors Default", 
    "All Errors", "EventLogProvider"));
' Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("All Errors Default", _
    "All Errors", "EventLogProvider"))

備註

下表顯示用於此建構函式的預設設定。

屬性 預設值
Custom 空字串 ("")。
MaxLimit MaxValue.
MinInstances 1.
MinInterval 0 個刻度。
Profile 空字串 ("")。

另請參閱

適用於

RuleSettings(String, String, String, String, Int32, Int32, TimeSpan)

初始化 RuleSettings 類別的新執行個體,其中除了 Custom 類別的值以外,所有的值都是指定的。

public:
 RuleSettings(System::String ^ name, System::String ^ eventName, System::String ^ provider, System::String ^ profile, int minInstances, int maxLimit, TimeSpan minInterval);
public RuleSettings (string name, string eventName, string provider, string profile, int minInstances, int maxLimit, TimeSpan minInterval);
new System.Web.Configuration.RuleSettings : string * string * string * string * int * int * TimeSpan -> System.Web.Configuration.RuleSettings
Public Sub New (name As String, eventName As String, provider As String, profile As String, minInstances As Integer, maxLimit As Integer, minInterval As TimeSpan)

參數

name
String

要建立的 RuleSettings 物件名稱。

eventName
String

適用這項規則的 EventMappingSettings 物件名稱。

provider
String

適用這項規則的 ProviderSettings 物件名稱。

profile
String

適用這項規則的 ProfileSettings 物件名稱。

minInstances
Int32

向提供者引發事件之前,相同事件型別發生的最少次數。

maxLimit
Int32

相同型別事件可以引發的最多次數。

minInterval
TimeSpan

兩個相同型別事件之間的最短間隔。

範例

下列程式碼範例示範如何使用 建 RuleSettings 構函式。 此程式碼範例是針對 類別提供的較大範例的 HealthMonitoringSection 一部分。

// Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("Failure Audits Default",
    "Failure Audits", "EventLogProvider", "Default", 1, Int32.MaxValue,
    new TimeSpan(0, 1, 0)));
' Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("Failure Audits Default", _
    "Failure Audits", "EventLogProvider", "Default", 1, Int32.MaxValue, _
    new TimeSpan(0, 1, 0)))

備註

下表顯示用於此建構函式的預設設定。

屬性 預設值
Custom 空字串 ("")。

另請參閱

適用於

RuleSettings(String, String, String, String, Int32, Int32, TimeSpan, String)

初始化 BufferModeSettings 類別的新執行個體,其中值是指定的。

public:
 RuleSettings(System::String ^ name, System::String ^ eventName, System::String ^ provider, System::String ^ profile, int minInstances, int maxLimit, TimeSpan minInterval, System::String ^ custom);
public RuleSettings (string name, string eventName, string provider, string profile, int minInstances, int maxLimit, TimeSpan minInterval, string custom);
new System.Web.Configuration.RuleSettings : string * string * string * string * int * int * TimeSpan * string -> System.Web.Configuration.RuleSettings
Public Sub New (name As String, eventName As String, provider As String, profile As String, minInstances As Integer, maxLimit As Integer, minInterval As TimeSpan, custom As String)

參數

name
String

要建立的 RuleSettings 物件名稱。

eventName
String

適用這項規則的 EventMappingSettings 物件名稱。

provider
String

適用這項規則的 ProviderSettings 物件名稱。

profile
String

適用這項規則的 ProfileSettings 物件名稱。

minInstances
Int32

向提供者引發事件之前,相同事件型別發生的最少次數。

maxLimit
Int32

相同型別事件引發的最多次數。

minInterval
TimeSpan

兩個相同型別事件之間的最短間隔。

custom
String

自訂類別的完整型別,會實作 IWebEventCustomEvaluator

範例

下列程式碼範例示範如何使用 建 RuleSettings 構函式。 此程式碼範例是針對 類別提供的較大範例的 HealthMonitoringSection 一部分。

// Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("Failure Audits Custom",
    "Failure Audits", "EventLogProvider", "Custom", 1, Int32.MaxValue,
    new TimeSpan(0, 1, 0), "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll"));
' Add a RuleSettings object to the Rules collection property.
healthMonitoringSection.Rules.Add(new RuleSettings("Failure Audits Custom", _
    "Failure Audits", "EventLogProvider", "Custom", 1, Int32.MaxValue, _
    new TimeSpan(0, 1, 0), "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll"))

備註

您必須提供這個建構函式的每個設定。

另請參閱

適用於