共用方式為


ValidationMessageObserver Class

Definition

ValidationMessageObserver reports errors/messages/warnings generated from validation methods. A ValidationMessageObserver is created with a given ValidationController as the ctor parameter. Once all the validation methods have been invoked, the observer picks up the messages being added/removed during the validation process and notify the user (via virturl overridable methods). This class also provides virtual method OnValidationBeginning and OnValidationEnded. This allows the derived class to know when the validation starts and ended.

The method will be called in the following order

  1. OnValidationBeginning
  2. OnValidationMessagesChanging
  3. OnValidationMessageRemoved - called once for each message removed.
  4. OnValidationMessageAdded - called once for each message added.
  5. OnValidationMessagesChangedSummary
  6. OnValidationEnded
public ref class ValidationMessageObserver abstract
public abstract class ValidationMessageObserver
type ValidationMessageObserver = class
Public MustInherit Class ValidationMessageObserver
Inheritance
ValidationMessageObserver
Derived

Constructors

ValidationMessageObserver()

Methods

OnValidationBeginning(ValidationContext)

Overriddable method to capture the validation beginning stats

OnValidationEnded(ValidationContext)

Overriddable method to capture the validation ended notification.

OnValidationMessageAdded(ValidationMessage)

Override to process each message added after the controller finishes the constraint validation.

OnValidationMessageRemoved(ValidationMessage)

Override to process each message removed after the controller finishes the constraint validation.

OnValidationMessagesChangedSummary(ReadOnlyCollection<ValidationMessage>, ReadOnlyCollection<ValidationMessage>)

Override to process a summary of the the change to the message collection.

OnValidationMessagesChanging(ReadOnlyCollection<ValidationMessage>, ReadOnlyCollection<ValidationMessage>, ReadOnlyCollection<ValidationMessage>, ReadOnlyCollection<ValidationMessage>)

Override to process a change to the message collection.

Applies to