共用方式為


Microsoft.VisualStudio.Modeling.Validation Namespace

Classes

ValidationContext

Context for validating model elements. The constructor will take a collection of model elements intended to be validated. Once the validaiton is done, the validation message will be staged in the CurrentViolations property.

ValidationController

groups logic for sdm model validtion.

ValidationMessage

ValidationMessage is used to carry validation messages that can be picked up by ValidationMessageObserver class. ValidationMessage are created from within user defined validation mehod. The actual creation is done via the virtual method ValidationContext.ConstructValidationMessage.

ValidationMessageObserver

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
ValidationMethodAttribute

Class definition for C# custom attribute ValidationMethod. This is used for marking methnods as Validator functions

ValidationStateAttribute

Attribute class used to mark meta-classes. A valid meta-class should have both [MetaObject] and [MetaClass] defined.

Enums

ValidationCategories

Flavor of the validaton categories...

ValidationState

ValidationState to indicate whether the constraint validation will be enabled for meta-class

ViolationType

Enum to show the violation type of the message