RuleSettings Klasa

Definicja

Konfiguruje reguły zdarzeń ASP.NET. Klasa ta nie może być dziedziczona.

public ref class RuleSettings sealed : System::Configuration::ConfigurationElement
public sealed class RuleSettings : System.Configuration.ConfigurationElement
type RuleSettings = class
    inherit ConfigurationElement
Public NotInheritable Class RuleSettings
Inherits ConfigurationElement
Dziedziczenie

Przykłady

Poniższy fragment pliku konfiguracji pokazuje, jak deklaratywnie określić właściwości RuleSettings klasy.

<healthMonitoring>  
    <rules>  
        <add name="All Errors Default"  
            eventName="All Errors"  
            provider="EventLogProvider"  
            profile="Default"  
            minInterval="00:01:00"   
        />  
        <add name="All Audits Default"  
            eventName="All Audits"  
            provider="SqlWebEventProvider"  
            profile="Default"  
            minInterval="00:00:30"   
        />  
        <add name="Failure Audits Default"  
            eventName="Failure Audits"  
            provider="WmiWebEventProvider"  
            profile="Critical"  
            minInterval="00:00:30"   
        />  
        <add name="Request Processing Errors"  
            eventName="Request Processing Errors"  
            provider="CriticalMailEventProvider"  
            profile="Default"  
        />  
        <add name="Infrastructure Notifications"  
            eventName="Infrastructure Errors"  
            provider="CriticalMailEventProvider"  
            profile="Critical"  
        />  
   </rules>  
</healthMonitoring>  

W poniższym przykładzie kodu pokazano, jak utworzyć i ustawić wartości RuleSettings typu. Ten przykład kodu jest częścią większego przykładu podanego HealthMonitoringSection dla klasy.

// Add a RuleSettings object to the Rules collection property.
RuleSettings ruleSetting = new RuleSettings("All Errors Default",
    "All Errors", "EventLogProvider");
ruleSetting.Name = "All Errors Custom";
ruleSetting.EventName = "All Errors";
ruleSetting.Provider = "EventLogProvider";
ruleSetting.Profile = "Custom";
ruleSetting.MaxLimit = Int32.MaxValue;
ruleSetting.MinInstances = 1;
ruleSetting.MinInterval = TimeSpan.Parse("00:00:30");
ruleSetting.Custom = "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll";
healthMonitoringSection.Rules.Add(ruleSetting);
' Add a RuleSettings object to the Rules collection property.
Dim ruleSetting As RuleSettings = new RuleSettings("All Errors Default", _
    "All Errors", "EventLogProvider")
ruleSetting.Name = "All Errors Custom"
ruleSetting.EventName = "All Errors"
ruleSetting.Provider = "EventLogProvider"
ruleSetting.Profile = "Custom"
ruleSetting.MaxLimit = Int32.MaxValue
ruleSetting.MinInstances = 1
ruleSetting.MinInterval = TimeSpan.Parse("00:00:30")
ruleSetting.Custom = "MyEvaluators.MyCustomeEvaluator2, MyCustom.dll"
healthMonitoringSection.Rules.Add(ruleSetting)

W poniższym przykładzie kodu pokazano, jak uzyskać i wyświetlić wartości RuleSettings typu. Ten przykład kodu jest częścią większego przykładu podanego HealthMonitoringSection dla klasy.

// Display contents of the Rules collection property
Console.WriteLine(
    "Rules Collection contains {0} values:", healthMonitoringSection.Rules.Count);

// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.Rules.Count; i++)
{
ruleSetting = healthMonitoringSection.Rules[i];
string name = ruleSetting.Name;
string eventName = ruleSetting.EventName;
string provider = ruleSetting.Provider;
string profile = ruleSetting.Profile;
int minInstances = ruleSetting.MinInstances;
int maxLimit = ruleSetting.MaxLimit;
TimeSpan minInterval = ruleSetting.MinInterval;
string custom = ruleSetting.Custom;
    string item = "Name='" + name + "', EventName='" + eventName +
        "', Provider =  '" + provider + "', Profile =  '" + profile +
        "', MinInstances =  '" + minInstances + "', MaxLimit =  '" + maxLimit +
        "', MinInterval =  '" + minInterval + "', Custom =  '" + custom + "'";
    Console.WriteLine("  Item {0}: {1}", i, item);
}
' Display contents of the Rules collection property
Console.WriteLine( _
    "Rules Collection contains {0} values:", healthMonitoringSection.Rules.Count)

' Display all elements.
For i As System.Int32 = 0 To healthMonitoringSection.Rules.Count -1
ruleSetting = healthMonitoringSection.Rules(i)
Dim name As String = ruleSetting.Name
Dim eventName As String = ruleSetting.EventName
Dim provider As String = ruleSetting.Provider
Dim profile As String = ruleSetting.Profile
Dim minInstances As Integer = ruleSetting.MinInstances
Dim maxLimit As Integer = ruleSetting.MaxLimit
Dim minInterval As TimeSpan = ruleSetting.MinInterval
Dim custom As String = ruleSetting.Custom
    Dim item As String = "Name='" & name & "', EventName='" & eventName & _
        "', Provider =  '" & provider & "', Profile =  '" & profile & _
        "', MinInstances =  '" & minInstances & "', MaxLimit =  '" & maxLimit & _
        "', MinInterval =  '" & minInterval.ToString() & "', Custom =  '" & custom & "'"
    Console.WriteLine("  Item {0}: {1}", i, item)
Next

Uwagi

Reguły zdarzeń określają, które zdarzenie, przy użyciu którego profilu, jest wyzwalane do którego dostawcy.

Konstruktory

RuleSettings(String, String, String)

Inicjuje RuleSettings nowe wystąpienie klasy przy użyciu ustawień domyślnych, jednak określono nazwę, nazwę zdarzenia i dostawcę.

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

Inicjuje nowe wystąpienie klasy, RuleSettings w którym określono wszystkie wartości z wyjątkiem tych klasy Custom .

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

Inicjuje nowe wystąpienie klasy, BufferModeSettings w którym określono wszystkie wartości.

Właściwości

CurrentConfiguration

Pobiera odwołanie do wystąpienia najwyższego poziomu Configuration , które reprezentuje hierarchię konfiguracji, do którego należy bieżące ConfigurationElement wystąpienie.

(Odziedziczone po ConfigurationElement)
Custom

Pobiera lub ustawia w pełni kwalifikowany typ klasy niestandardowej, która implementuje IWebEventCustomEvaluatorelement .

ElementInformation

ElementInformation Pobiera obiekt, który zawiera niezstosowalne informacje i funkcje ConfigurationElement obiektu.

(Odziedziczone po ConfigurationElement)
ElementProperty

ConfigurationElementProperty Pobiera obiekt reprezentujący ConfigurationElement sam obiekt.

(Odziedziczone po ConfigurationElement)
EvaluationContext

ContextInformation Pobiera obiekt dla ConfigurationElement obiektu.

(Odziedziczone po ConfigurationElement)
EventName

Pobiera lub ustawia nazwę obiektu, do których EventMappingSettings ma zastosowanie ta reguła.

HasContext

Pobiera wartość wskazującą, czy CurrentConfiguration właściwość to null.

(Odziedziczone po ConfigurationElement)
Item[ConfigurationProperty]

Pobiera lub ustawia właściwość lub atrybut tego elementu konfiguracji.

(Odziedziczone po ConfigurationElement)
Item[String]

Pobiera lub ustawia właściwość, atrybut lub element podrzędny tego elementu konfiguracji.

(Odziedziczone po ConfigurationElement)
LockAllAttributesExcept

Pobiera kolekcję zablokowanych atrybutów.

(Odziedziczone po ConfigurationElement)
LockAllElementsExcept

Pobiera kolekcję zablokowanych elementów.

(Odziedziczone po ConfigurationElement)
LockAttributes

Pobiera kolekcję zablokowanych atrybutów.

(Odziedziczone po ConfigurationElement)
LockElements

Pobiera kolekcję zablokowanych elementów.

(Odziedziczone po ConfigurationElement)
LockItem

Pobiera lub ustawia wartość wskazującą, czy element jest zablokowany.

(Odziedziczone po ConfigurationElement)
MaxLimit

Pobiera lub ustawia maksymalną liczbę zgłoszonych zdarzeń tego samego typu.

MinInstances

Pobiera lub ustawia minimalną liczbę wystąpień tego samego typu zdarzenia, zanim zdarzenie zostanie podniesione do dostawcy.

MinInterval

Pobiera lub ustawia minimalny interwał czasu między dwoma zdarzeniami tego samego typu.

Name

Pobiera lub ustawia nazwę RuleSettings obiektu.

Profile

Pobiera lub ustawia nazwę obiektu, do których ProfileSettings ma zastosowanie ta reguła.

Properties

Pobiera kolekcję właściwości.

(Odziedziczone po ConfigurationElement)
Provider

Pobiera lub ustawia nazwę obiektu, do których ProviderSettings ma zastosowanie ta reguła.

Metody

DeserializeElement(XmlReader, Boolean)

Odczytuje kod XML z pliku konfiguracji.

(Odziedziczone po ConfigurationElement)
Equals(Object)

Porównuje bieżące ConfigurationElement wystąpienie z określonym obiektem.

(Odziedziczone po ConfigurationElement)
GetHashCode()

Pobiera unikatową wartość reprezentującą bieżące ConfigurationElement wystąpienie.

(Odziedziczone po ConfigurationElement)
GetTransformedAssemblyString(String)

Zwraca przekształconą wersję określonej nazwy zestawu.

(Odziedziczone po ConfigurationElement)
GetTransformedTypeString(String)

Zwraca przekształconą wersję określonej nazwy typu.

(Odziedziczone po ConfigurationElement)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
Init()

ConfigurationElement Ustawia obiekt na stan początkowy.

(Odziedziczone po ConfigurationElement)
InitializeDefault()

Służy do inicjowania domyślnego zestawu wartości dla ConfigurationElement obiektu.

(Odziedziczone po ConfigurationElement)
IsModified()

Wskazuje, czy ten element konfiguracji został zmodyfikowany od czasu ostatniego zapisania lub załadowania, gdy został zaimplementowany w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
IsReadOnly()

Pobiera wartość wskazującą, czy ConfigurationElement obiekt jest tylko do odczytu.

(Odziedziczone po ConfigurationElement)
ListErrors(IList)

Dodaje błędy nieprawidłowej właściwości w tym ConfigurationElement obiekcie i we wszystkich podelementach do przekazanej listy.

(Odziedziczone po ConfigurationElement)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
OnDeserializeUnrecognizedAttribute(String, String)

Pobiera wartość wskazującą, czy podczas deserializacji napotkano nieznany atrybut.

(Odziedziczone po ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

Pobiera wartość wskazującą, czy podczas deserializacji napotkano nieznany element.

(Odziedziczone po ConfigurationElement)
OnRequiredPropertyNotFound(String)

Zgłasza wyjątek, gdy nie znaleziono wymaganej właściwości.

(Odziedziczone po ConfigurationElement)
PostDeserialize()

Wywoływana po deserializacji.

(Odziedziczone po ConfigurationElement)
PreSerialize(XmlWriter)

Wywoływane przed serializacji.

(Odziedziczone po ConfigurationElement)
Reset(ConfigurationElement)

Resetuje stan ConfigurationElement wewnętrzny obiektu, w tym blokady i kolekcje właściwości.

(Odziedziczone po ConfigurationElement)
ResetModified()

Resetuje wartość IsModified() metody w false przypadku implementacji w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SerializeElement(XmlWriter, Boolean)

Zapisuje zawartość tego elementu konfiguracji do pliku konfiguracji po zaimplementowaniu w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SerializeToXmlElement(XmlWriter, String)

Zapisuje zewnętrzne tagi tego elementu konfiguracji do pliku konfiguracji po zaimplementowaniu w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

Ustawia właściwość na określoną wartość.

(Odziedziczone po ConfigurationElement)
SetReadOnly()

IsReadOnly() Ustawia właściwość obiektu ConfigurationElement i wszystkich podelementów.

(Odziedziczone po ConfigurationElement)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

Modyfikuje obiekt, ConfigurationElement aby usunąć wszystkie wartości, które nie powinny być zapisywane.

(Odziedziczone po ConfigurationElement)

Dotyczy

Zobacz też