HealthMonitoringSection.EventMappings 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
EventMappingSettingsCollection 개체의 EventMappingSettings 컬렉션을 가져옵니다.
public:
property System::Web::Configuration::EventMappingSettingsCollection ^ EventMappings { System::Web::Configuration::EventMappingSettingsCollection ^ get(); };
[System.Configuration.ConfigurationProperty("eventMappings")]
public System.Web.Configuration.EventMappingSettingsCollection EventMappings { get; }
[<System.Configuration.ConfigurationProperty("eventMappings")>]
member this.EventMappings : System.Web.Configuration.EventMappingSettingsCollection
Public ReadOnly Property EventMappings As EventMappingSettingsCollection
속성 값
EventMappingSettingsCollection 개체의 EventMappingSettings 컬렉션입니다. 기본값은 빈 EventMappingSettingsCollection 컬렉션입니다.
- 특성
예제
다음 코드 예제에서는 EventMappings 속성을 사용하는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 HealthMonitoringSection 클래스입니다.
// Add a EventMappingsSettings object to the EventMappings collection property.
EventMappingSettings eventMappingSetting = new EventMappingSettings(
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web");
eventMappingSetting.Name = "All Errors";
eventMappingSetting.Type =
"System.Web.Management.WebErrorEvent, System.Web";
eventMappingSetting.StartEventCode = 0;
eventMappingSetting.EndEventCode = 4096;
healthMonitoringSection.EventMappings.Add(eventMappingSetting);
// Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings(
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web"));
// Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings(
"Success Audits", "System.Web.Management.WebAuditEvent, System.Web",
512, Int32.MaxValue));
// Insert an EventMappingsSettings object into the EventMappings collection property.
healthMonitoringSection.EventMappings.Insert(1,
new EventMappingSettings("HeartBeats", "", 1, 2));
// Display contents of the EventMappings collection property
Console.WriteLine(
"EventMappings Collection contains {0} values:", healthMonitoringSection.EventMappings.Count);
// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.EventMappings.Count; i++)
{
eventMappingSetting = healthMonitoringSection.EventMappings[i];
string name = eventMappingSetting.Name;
string type = eventMappingSetting.Type;
int startCd = eventMappingSetting.StartEventCode;
int endCd = eventMappingSetting.EndEventCode;
string item = "Name='" + name + "', Type='" + type +
"', StartEventCode = '" + startCd.ToString() +
"', EndEventCode = '" + endCd.ToString() + "'";
Console.WriteLine(" Item {0}: {1}", i, item);
}
// See if the EventMappings collection property contains the event 'HeartBeats'.
Console.WriteLine("EventMappings contains 'HeartBeats': {0}.",
healthMonitoringSection.EventMappings.Contains("HeartBeats"));
// Get the index of the 'HeartBeats' event in the EventMappings collection property.
Console.WriteLine("EventMappings index for 'HeartBeats': {0}.",
healthMonitoringSection.EventMappings.IndexOf("HeartBeats"));
// Get a named EventMappings
eventMappingSetting = healthMonitoringSection.EventMappings["HeartBeats"];
// Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Remove("HeartBeats");
// Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.RemoveAt(0);
// Clear all EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Clear();
' Add a EventMappingsSettings object to the EventMappings collection property.
Dim eventMappingSetting As EventMappingSettings = New EventMappingSettings( _
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web")
eventMappingSetting.Name = "All Errors"
eventMappingSetting.Type = _
"System.Web.Management.WebErrorEvent, System.Web"
eventMappingSetting.StartEventCode = 0
eventMappingSetting.EndEventCode = 4096
healthMonitoringSection.EventMappings.Add(eventMappingSetting)
' Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings( _
"Failure Audits", "System.Web.Management.WebAuditEvent, System.Web"))
' Add an EventMappingsSettings object to the EventMappings collection property.
healthMonitoringSection.EventMappings.Add(new EventMappingSettings( _
"Success Audits", "System.Web.Management.WebAuditEvent, System.Web", _
512, Int32.MaxValue))
' Insert an EventMappingsSettings object into the EventMappings collection property.
healthMonitoringSection.EventMappings.Insert(1, _
new EventMappingSettings("HeartBeats", "", 1, 2))
' Display contents of the EventMappings collection property
Console.WriteLine( _
"EventMappings Collection contains {0} values:", healthMonitoringSection.EventMappings.Count)
' Display all elements.
For i As System.Int32 = 0 To healthMonitoringSection.EventMappings.Count - 1
eventMappingSetting = healthMonitoringSection.EventMappings(i)
Dim name As String = eventMappingSetting.Name
Dim type As String = eventMappingSetting.Type
Dim startCd As Integer = eventMappingSetting.StartEventCode
Dim endCd As Integer = eventMappingSetting.EndEventCode
Dim item As String = "Name='" & name & "', Type='" & type & _
"', StartEventCode = '" & startCd.ToString() & _
"', EndEventCode = '" & endCd.ToString() & "'"
Console.WriteLine(" Item {0}: {1}", i, item)
Next
' See if the EventMappings collection property contains the event 'HeartBeats'.
Console.WriteLine("EventMappings contains 'HeartBeats': {0}.", _
healthMonitoringSection.EventMappings.Contains("HeartBeats"))
' Get the index of the 'HeartBeats' event in the EventMappings collection property.
Console.WriteLine("EventMappings index for 'HeartBeats': {0}.", _
healthMonitoringSection.EventMappings.IndexOf("HeartBeats"))
' Get a named EventMappings
eventMappingSetting = healthMonitoringSection.EventMappings("HeartBeats")
' Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Remove("HeartBeats")
' Remove an EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.RemoveAt(0)
' Clear all EventMappingsSettings object from the EventMappings collection property.
healthMonitoringSection.EventMappings.Clear()