共用方式為


Microsoft.VisualStudio.Modeling.Validation Namespace

The Microsoft.VisualStudio.Modeling.Validation namespace provides classes that you can use to check a model for valid data and consistency between its elements. Validation is integrated into Visual Studio so that errors, warnings, and messages detected during validation appear in the Error List window.

You can specify that validation occurs when the user opens a model, saves a model, or clicks a validation option from a shortcut menu. You can also invoke validation from program code, for example as part of an event handler or menu command.

For more information, see Validation in a Domain-Specific Language.

Classes

  Class Description
Public class ValidationContext Contains information about the current validation processing being performed.
Public class ValidationController Contains logic to validate a single model element or all model elements in a store or partition.
Public class ValidationMessage Represents a validation message that states an error, a warning, or a message.
Public class ValidationMessageObserver Reports errors, messages, and warnings that are generated from validation methods.
Public class ValidationMethodAttribute Apply this attribute to methods that should be invoked during validation.
Public class ValidationStateAttribute Apply this attribute to a model element class to control whether its instances are included in validation operations. By default, a model element is validated only if validation is explicitly enabled for a class to which it belongs, using this attribute.

Enumerations

  Enumeration Description
Public enumeration ValidationCategories This enumeration is a parameter for the constructor of the custom attribute, ValidationMethodAttribute. It specifies the type of validation in which the rule will be invoked.
Public enumeration ValidationState Identifies whether instances of a class will be enabled for validation.
Public enumeration ViolationType Represents the type of violation that has occurred during validation.