ValidationStateAttribute Class
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.
Assembly: Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)
System::Attribute
Microsoft.VisualStudio.Modeling.Validation::ValidationStateAttribute
| Name | Description | |
|---|---|---|
![]() | ValidationStateAttribute(ValidationState) | Apply this attribute to a model element class to control whether its instances are included in validation operations. |
| Name | Description | |
|---|---|---|
![]() | TypeId | (Inherited from Attribute.) |
![]() | ValidationState | Gets the value of ValidationStateAttribute. |
| Name | Description | |
|---|---|---|
![]() | Equals(Object^) | (Inherited from Attribute.) |
![]() | GetHashCode() | (Inherited from Attribute.) |
![]() | GetType() | (Inherited from Object.) |
![]() | IsDefaultAttribute() | (Inherited from Attribute.) |
![]() | Match(Object^) | (Inherited from Attribute.) |
![]() | ToString() | (Inherited from Object.) |
| Name | Description | |
|---|---|---|
![]() ![]() | _Attribute::GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
![]() ![]() | _Attribute::GetTypeInfo(UInt32, UInt32, IntPtr) | (Inherited from Attribute.) |
![]() ![]() | _Attribute::GetTypeInfoCount(UInt32) | (Inherited from Attribute.) |
![]() ![]() | _Attribute::Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) | (Inherited from Attribute.) |
This attribute enables or disables validation for each domain type.
The values can be:
Enabled
Disabled
Inherited
By default, the validation for a domain type is Inherited. This means that the class will have the same validation behavior as its base class. If there is no explicit base class, the default is Disabled.
Therefore, if you want validation to be applied to model elements, you must explicitly apply this attribute to the domain classes to which they belong.
If you apply the attribute to a base class, you do not need to apply it to derived classes unless you want to exclude them from validation.
For more information, see Validation in a Domain-Specific Language.
The following example shows the ValidationState attribute applied to the Person class, which enables validation for that class.
[C#]
[ValidationState(ValidationState.Enabled)]
public partial class Person
{
//Code goes here...
}
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



