Upraviť

Zdieľať cez


ValidationAttribute Constructors

Definition

Initializes a new instance of the ValidationAttribute class.

Overloads

ValidationAttribute()

Initializes a new instance of the ValidationAttribute class.

ValidationAttribute(Func<String>)

Initializes a new instance of the ValidationAttribute class by using the function that enables access to validation resources.

ValidationAttribute(String)

Initializes a new instance of the ValidationAttribute class by using the error message to associate with a validation control.

ValidationAttribute()

Source:
ValidationAttribute.cs
Source:
ValidationAttribute.cs
Source:
ValidationAttribute.cs

Initializes a new instance of the ValidationAttribute class.

protected:
 ValidationAttribute();
protected ValidationAttribute ();
Protected Sub New ()

Remarks

This constructor chooses a generic validation error message. If you subclass ValidationAttribute, use other constructors or supply a better message.

Applies to

ValidationAttribute(Func<String>)

Source:
ValidationAttribute.cs
Source:
ValidationAttribute.cs
Source:
ValidationAttribute.cs

Initializes a new instance of the ValidationAttribute class by using the function that enables access to validation resources.

protected:
 ValidationAttribute(Func<System::String ^> ^ errorMessageAccessor);
protected ValidationAttribute (Func<string> errorMessageAccessor);
new System.ComponentModel.DataAnnotations.ValidationAttribute : Func<string> -> System.ComponentModel.DataAnnotations.ValidationAttribute
Protected Sub New (errorMessageAccessor As Func(Of String))

Parameters

errorMessageAccessor
Func<String>

The function that enables access to validation resources.

Exceptions

errorMessageAccessor is null.

Remarks

This constructor provides a resource accessor function that is used by the ErrorMessageString property to retrieve an error message.

Applies to

ValidationAttribute(String)

Source:
ValidationAttribute.cs
Source:
ValidationAttribute.cs
Source:
ValidationAttribute.cs

Initializes a new instance of the ValidationAttribute class by using the error message to associate with a validation control.

protected:
 ValidationAttribute(System::String ^ errorMessage);
protected ValidationAttribute (string errorMessage);
new System.ComponentModel.DataAnnotations.ValidationAttribute : string -> System.ComponentModel.DataAnnotations.ValidationAttribute
Protected Sub New (errorMessage As String)

Parameters

errorMessage
String

The error message to associate with a validation control.

Applies to