ValidationController Class
Contains logic to validate a single model element or all model elements in a store or partition.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Modeling.Validation.ValidationController
Microsoft.VisualStudio.Modeling.Shell.VsValidationController
Namespace: Microsoft.VisualStudio.Modeling.Validation
Assembly: Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)
Syntax
'Declaration
Public Class ValidationController
public class ValidationController
public ref class ValidationController
type ValidationController = class end
public class ValidationController
The ValidationController type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ValidationController | Creates a new instance of the ValidationController class. |
Top
Properties
Name | Description | |
---|---|---|
ErrorMessages | Gets a copy of all the active error and fatal messages. | |
FatalMessages | Gets a copy of all the active fatal messages. | |
IncludeLinkedExtensionElements | Indicates whether ExtensionElements linked to the ModelElements being validated should also be validated. ExtensionElements allow a DSL definition to be extended by a third party. | |
InformationalMessages | gets a copy of all the active informational messages. | |
ValidationExtensionRegistrar | Property for ValidationExtension Registrar | |
ValidationMessages | Gets the validation messages for the controller. | |
WarningMessages | Gets a copy of all the active warning messages. |
Top
Methods
Name | Description | |
---|---|---|
AddObserver | Adds an observer to the list of observers for the controller. The observer will be notified when a message is added to or removed from the list for this controller. | |
ClearMessages | Removes all error and warning messages from the controller. | |
CreateValidationContext(IEnumerable<ModelElement>, ValidationCategories) | Creates a validation context for validation of a list of elements. | |
CreateValidationContext(IEnumerable<ModelElement>, array<String[]) | Create a context for validation of a collection of model elements. Every validation method that belongs to any of the specified custom categories will be applied to every element in the subjects list. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetExtensionElements | Calculates and returns a list of extension elements that should be included in the list of elements being validated | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
RemoveObserver | Removes the observer from the list of observers for the controller. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Validate(ModelElement, ValidationCategories) | Do validation for a single element, invoking validation methods that have ValidationMethod attributes for one or more of the specified validation categories. | |
Validate(IEnumerable<ModelElement>, ValidationCategories) | Apply validation methods to every model element in a list. Methods will be invoked that have a ValidationMethod attribute for one or more of the specified Categories. | |
Validate(Partition, ValidationCategories) | Apply validation to every element in the specified partition, invoking validation methods that have ValidationMethod attributes for one or more of the specified categories. | |
Validate(Store, ValidationCategories) | Apply validation to every element in the Store, invoking methods that have ValidationMethod attributes for one or more of the specified categories. | |
ValidateCustom(ModelElement, array<String[]) | Validates the specified model element using validation methods in the specified custom validation categories. | |
ValidateCustom(IEnumerable<ModelElement>, array<String[]) | Apply validation methods to each element in the collection. Each validation method in any of the chosen categories is applied to each element in the list. A validation method is in a category if it has a ValidationMethod attribute that specifies the category. | |
ValidateCustom(Partition, array<String[]) | Validates the model elements in a partition for the specified custom validation categories. | |
ValidateCustom(Store, array<String[]) | Validates every model elements in a store, using validation methods in the specified custom categories. A validation method belongs to a category if it has a ValidationMethod attribute specifying that category. |
Top
Remarks
A ValidationController is created if you enable any validation setting in the model.
For example, this XML element in the DslDefinition file (the .dsl file) enables validation and creates a ValidationController object:
<Validation UsesOpen="true" UsesMenu="true" UsesSave="true" UsesCustom="false" />
You can derive a class from ValidationController and register to be notified of validation events.
For more information, see Validation in a Domain-Specific Language.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.