WebBaseEventCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
개체 컬렉션을 WebBaseEvent 포함합니다. 이 클래스는 상속할 수 없습니다.
public ref class WebBaseEventCollection sealed : System::Collections::ReadOnlyCollectionBase
public sealed class WebBaseEventCollection : System.Collections.ReadOnlyCollectionBase
type WebBaseEventCollection = class
inherit ReadOnlyCollectionBase
Public NotInheritable Class WebBaseEventCollection
Inherits ReadOnlyCollectionBase
- 상속
예제
다음 코드 예제에서는 클래스를 사용 하는 방법을 보여 있습니다 WebBaseEventCollection .
using System;
using System.Text;
using System.Web;
using System.Web.Management;
using System.Collections;
namespace SamplesAspNet
{
// Implements a custom WebBaseEvent class.
// Everytime this class is instantiated a WebBaseEvent is
// created. This event object is then added to the static
// simulatedEvents array list.
public class SampleWebBaseEventCollection : System.Web.Management.WebBaseEvent
{
private string customCreatedMsg;
private static ArrayList simulatedEvents = new ArrayList();
private static System.Web.Management.WebBaseEventCollection events;
// Create a new WebBaseEvent and add it to the
// static array list simulatedEvents.
public SampleWebBaseEventCollection(
string msg, object eventSource, int eventCode):
base(msg, eventSource, eventCode)
{
customCreatedMsg =
string.Format("Event created at: {0}",
DateTime.Now.TimeOfDay.ToString());
simulatedEvents.Add(this);
}
// Get the event with the specified index.
public static WebBaseEvent GetItem(int index)
{
return events[index];
}
// Get the index of the specified event.
public static int GetIndexOf(WebBaseEvent ev)
{
return events.IndexOf(ev);
}
// Check if the specified event is in the collection.
public static bool ContainsEvent(WebBaseEvent ev)
{
return events.Contains(ev);
}
// Create an event collection.
// Add to it the created simulatedEvents.
public static void AddEvents()
{
events =
new System.Web.Management.WebBaseEventCollection(
simulatedEvents);
}
// Display the events contained in the collection.
public override void FormatCustomEventDetails(WebEventFormatter formatter)
{
base.FormatCustomEventDetails(formatter);
// Add custom data.
formatter.AppendLine("");
formatter.IndentationLevel += 1;
formatter.AppendLine(
"**SampleWebBaseEventCollection Data Start **");
foreach (WebBaseEvent ev in events)
{
formatter.AppendLine(string.Format(
"Message: {0}", ev.Message));
formatter.AppendLine(string.Format(
"Source: {0}", ev.EventSource.ToString()));
formatter.AppendLine(string.Format(
"Code: {0}", ev.EventCode.ToString()));
}
formatter.AppendLine(
"**SampleWebBaseEventCollection Data End **");
formatter.IndentationLevel -= 1;
}
}
}
Imports System.Text
Imports System.Web
Imports System.Web.Management
Imports System.Collections
' Implements a custom WebBaseEvent class.
' Everytime this class is instantiated a WebBaseEvent is
' created. This event object is then added to the static
' simulatedEvents array list.
Public Class SampleWebBaseEventCollection
Inherits System.Web.Management.WebBaseEvent
Private customCreatedMsg As String
Private Shared simulatedEvents As New ArrayList()
Private Shared events _
As System.Web.Management.WebBaseEventCollection
' Create a new WebBaseEvent and add it to the
' static array list simulatedEvents.
Public Sub New(ByVal msg As String, ByVal eventSource As Object, _
ByVal eventCode As Integer)
MyBase.New(msg, eventSource, eventCode)
customCreatedMsg = String.Format("Event created at: {0}", _
DateTime.Now.TimeOfDay.ToString())
simulatedEvents.Add(Me)
End Sub
' Get the event with the specified index.
Public Shared Function GetItem(ByVal index _
As Integer) As WebBaseEvent
Return events(index)
End Function 'GetItem
' Get the index of the specified event.
Public Shared Function GetIndexOf(ByVal ev _
As WebBaseEvent) As Integer
Return events.IndexOf(ev)
End Function 'GetIndexOf
' Chek if the specified event is in the collection.
Public Shared Function ContainsEvent(ByVal ev _
As WebBaseEvent) As Boolean
Return events.Contains(ev)
End Function 'ContainsEvent
' Create an event collection.
' Add to it the created simulatedEvents.
Public Shared Sub AddEvents()
events = _
New System.Web.Management.WebBaseEventCollection(simulatedEvents)
End Sub
' Display the events contained in the collection.
Public Overrides Sub FormatCustomEventDetails(ByVal formatter _
As WebEventFormatter)
MyBase.FormatCustomEventDetails(formatter)
' Add custom data.
formatter.AppendLine("")
formatter.IndentationLevel += 1
formatter.AppendLine("**SampleWebBaseEventCollection Data Start **")
Dim ev As WebBaseEvent
For Each ev In events
formatter.AppendLine(String.Format("Message: {0}", _
ev.Message))
formatter.AppendLine(String.Format("Source: {0}", _
ev.EventSource.ToString()))
formatter.AppendLine(String.Format("Code: {0}", _
ev.EventCode.ToString()))
Next ev
formatter.AppendLine("**SampleWebBaseEventCollection Data End **")
formatter.IndentationLevel -= 1
End Sub
End Class
설명
ASP.NET 상태 모니터링을 사용하면 프로덕션 및 운영 직원이 배포된 웹 애플리케이션을 관리할 수 있습니다. 네임스페이스에는 System.Web.Management 애플리케이션 상태 데이터 패키징을 담당하는 상태 이벤트 유형과 이 데이터 처리를 담당하는 공급자 유형이 포함됩니다. 또한 상태 이벤트를 관리하는 동안 도움이 되는 지원 유형도 포함합니다.
이 WebBaseEventCollection 클래스는 상태 모니터링 이벤트 컬렉션을 공급자(예: SqlWebEventProvider)에 전달하는 데 사용됩니다.
생성자
| Name | Description |
|---|---|
| WebBaseEventCollection(ICollection) |
WebBaseEventCollection 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Count |
인스턴스에 포함된 ReadOnlyCollectionBase 요소 수를 가져옵니다. (다음에서 상속됨 ReadOnlyCollectionBase) |
| InnerList |
인스턴스에 포함된 ReadOnlyCollectionBase 요소 목록을 가져옵니다. (다음에서 상속됨 ReadOnlyCollectionBase) |
| Item[Int32] |
지정된 인덱스에서 WebBaseEvent 개체를 가져옵니다. |
메서드
| Name | Description |
|---|---|
| Contains(WebBaseEvent) |
컬렉션에 지정된 WebBaseEvent 개체가 포함되어 있는지 여부를 나타냅니다. |
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetEnumerator() |
인스턴스를 반복하는 열거자를 반환합니다 ReadOnlyCollectionBase . (다음에서 상속됨 ReadOnlyCollectionBase) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| IndexOf(WebBaseEvent) |
지정된 WebBaseEvent 개체의 인덱스입니다. |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
대상 배열의 지정된 인덱스에서 시작하여 호환되는 1차원ReadOnlyCollectionBase으로 전체를 Array 복사합니다. (다음에서 상속됨 ReadOnlyCollectionBase) |
| ICollection.IsSynchronized |
개체에 대한 액세스 ReadOnlyCollectionBase 가 동기화되는지 여부를 나타내는 값을 가져옵니다(스레드로부터 안전). (다음에서 상속됨 ReadOnlyCollectionBase) |
| ICollection.SyncRoot |
개체에 대한 액세스를 동기화하는 데 사용할 수 있는 개체를 ReadOnlyCollectionBase 가져옵니다. (다음에서 상속됨 ReadOnlyCollectionBase) |
확장명 메서드
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
쿼리의 병렬 처리를 사용하도록 설정합니다. |
| AsQueryable(IEnumerable) |
IEnumerable IQueryable변환합니다. |
| Cast<TResult>(IEnumerable) |
IEnumerable 요소를 지정된 형식으로 캐스팅합니다. |
| OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable 요소를 필터링합니다. |