RuleSettings 构造函数
定义
初始化 RuleSettings 类的新实例。Initializes a new instance of the RuleSettings class.
重载
| RuleSettings(String, String, String) |
使用默认设置初始化 RuleSettings 类的新实例;但名称、事件名称和提供程序是指定的。Initializes a new instance of the RuleSettings class using default settings; however, the name, event name, and provider are specified. |
| RuleSettings(String, String, String, String, Int32, Int32, TimeSpan) |
初始化 RuleSettings 类的新实例,其中除 Custom 类的值以外的所有值都是指定的。Initializes a new instance of the RuleSettings class where all values except those of the Custom class are specified. |
| RuleSettings(String, String, String, String, Int32, Int32, TimeSpan, String) |
初始化 BufferModeSettings 类的新实例,其中所有值都是指定的。Initializes a new instance of the BufferModeSettings class where all values are specified. |
RuleSettings(String, String, String)
使用默认设置初始化 RuleSettings 类的新实例;但名称、事件名称和提供程序是指定的。Initializes a new instance of the RuleSettings class using default settings; however, the name, event name, and provider are specified.
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 对象的名称。The name of the RuleSettings object to create.
- eventName
- String
此规则适用的 EventMappingSettings 对象的名称。The name of the EventMappingSettings object this rule applies to.
- provider
- String
此规则适用的 ProviderSettings 对象的名称。The name of the ProviderSettings object this rule applies to.
示例
下面的代码示例演示如何使用 RuleSettings 构造函数。The following code example shows how to use the RuleSettings constructor. 此代码示例是为类提供的更大示例的一部分 HealthMonitoringSection 。This code example is part of a larger example provided for the HealthMonitoringSection class.
// 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"))
注解
下表显示了用于此构造函数的默认设置。The following table shows the default settings that are used for this constructor.
| propertiesProperty | 默认值Default value |
|---|---|
| Custom | 空字符串 ("")。An empty string (""). |
| MaxLimit | MaxValue.MaxValue. |
| MinInstances | 1.1. |
| MinInterval | 0刻度。0 ticks. |
| Profile | 空字符串 ("")。An empty string (""). |
另请参阅
适用于
RuleSettings(String, String, String, String, Int32, Int32, TimeSpan)
初始化 RuleSettings 类的新实例,其中除 Custom 类的值以外的所有值都是指定的。Initializes a new instance of the RuleSettings class where all values except those of the Custom class are specified.
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 对象的名称。The name of the RuleSettings object to create.
- eventName
- String
此规则适用的 EventMappingSettings 对象的名称。The name of the EventMappingSettings object this rule applies to.
- provider
- String
此规则适用的 ProviderSettings 对象的名称。The name of the ProviderSettings object this rule applies to.
- profile
- String
此规则适用的 ProfileSettings 对象的名称。The name of the ProfileSettings object this rule applies to.
- minInstances
- Int32
在事件引发至提供程序之前可发生的相同类型事件的最少发生次数。The minimum number of occurrences of the same type of event that can occur before the event is raised to the provider.
- maxLimit
- Int32
可引发相同类型事件的最大次数。The maximum number of times events of the same type can be raised.
- minInterval
- TimeSpan
相同类型的两个事件之间的最小时间间隔。The minimum time interval between two events of the same type.
示例
下面的代码示例演示如何使用 RuleSettings 构造函数。The following code example shows how to use the RuleSettings constructor. 此代码示例是为类提供的更大示例的一部分 HealthMonitoringSection 。This code example is part of a larger example provided for the HealthMonitoringSection class.
// 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)))
注解
下表显示了用于此构造函数的默认设置。The following table shows the default settings that are used for this constructor.
| propertiesProperty | 默认值Default value |
|---|---|
| Custom | 空字符串 ("")。An empty string (""). |
另请参阅
适用于
RuleSettings(String, String, String, String, Int32, Int32, TimeSpan, String)
初始化 BufferModeSettings 类的新实例,其中所有值都是指定的。Initializes a new instance of the BufferModeSettings class where all values are specified.
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 对象的名称。The name of the RuleSettings object to create.
- eventName
- String
此规则适用的 EventMappingSettings 对象的名称。The name of the EventMappingSettings object this rule applies to.
- provider
- String
此规则适用的 ProviderSettings 对象的名称。The name of the ProviderSettings object this rule applies to.
- profile
- String
此规则适用的 ProfileSettings 对象的名称。The name of the ProfileSettings object this rule applies to.
- minInstances
- Int32
在事件引发至提供程序之前相同类型事件的最少发生次数。The minimum number of occurrences of an event of the same type before the event is fired to the provider.
- maxLimit
- Int32
引发相同类型事件的最大次数。The maximum number of times events of the same type are fired.
- minInterval
- TimeSpan
相同类型的两个事件之间的最小时间间隔。The minimum time interval between two events of the same type.
- custom
- String
实现 IWebEventCustomEvaluator 的自定义类的完全限定类型。The fully qualified type of a custom class that implements IWebEventCustomEvaluator.
示例
下面的代码示例演示如何使用 RuleSettings 构造函数。The following code example shows how to use the RuleSettings constructor. 此代码示例是为类提供的更大示例的一部分 HealthMonitoringSection 。This code example is part of a larger example provided for the HealthMonitoringSection class.
// 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"))
注解
必须提供此构造函数的每个设置。You must provide every setting for this constructor.