Share via


ValidationStateAttribute Class

Indicates whether you can validate the domain type to which you applied the attribute.

Namespace:  Microsoft.VisualStudio.Modeling.Validation
Assembly:  Microsoft.VisualStudio.Modeling.Sdk (in Microsoft.VisualStudio.Modeling.Sdk.dll)

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple := True)> _
Public NotInheritable Class ValidationStateAttribute _
    Inherits Attribute
'Usage
Dim instance As ValidationStateAttribute
[AttributeUsageAttribute(AttributeTargets.Class, AllowMultiple = true)]
public sealed class ValidationStateAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = true)]
public ref class ValidationStateAttribute sealed : public Attribute
public final class ValidationStateAttribute extends Attribute

Remarks

This attribute enables or disables validation for each domain type.

The values can be:

  • Enabled

  • Disabled

  • Inherited

  • If the attribute is set to Inherited, the class will have the same validation behavior as its parent class.

By default, validation is disabled. Therefore, you can validate a class only if validation is explicitly enabled or if the class is set to inherit the setting of its parent class and the parent class is enabled for validation.

Examples

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...
}

Inheritance Hierarchy

System.Object
  System.Attribute
    Microsoft.VisualStudio.Modeling.Validation.ValidationStateAttribute

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.

See Also

Reference

ValidationStateAttribute Members

Microsoft.VisualStudio.Modeling.Validation Namespace