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.
| Class | Description | |
|---|---|---|
![]() | ValidationContext | Contains information about the current validation processing being performed. |
![]() | ValidationController | Contains logic to validate a single model element or all model elements in a store or partition. |
![]() | ValidationMessage | Represents a validation message that states an error, a warning, or a message. |
![]() | ValidationMessageObserver | Reports errors, messages, and warnings that are generated from validation methods. |
![]() | ValidationMethodAttribute | Apply this attribute to methods that should be invoked during validation. |
![]() | 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. |
| Enumeration | Description | |
|---|---|---|
![]() | 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. |
![]() | ValidationState | Identifies whether instances of a class will be enabled for validation. |
![]() | ViolationType | Represents the type of violation that has occurred during validation. |
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.

