C# Class StringLengthAttribute, i18N-Complete

Inheritance: System.ComponentModel.DataAnnotations.StringLengthAttribute
Exibir arquivo Open project: adaptabi/i18N-Complete Class Usage Examples

Public Methods

Method Description
FormatErrorMessage ( string name ) : string

Applies formatting to a specified error message.

StringLengthAttribute ( int maximumLength ) : System

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.

ErrorMessage is set to:

The {0} must be at least {2} characters long.

StringLengthAttribute ( int maximumLength, int minLength ) : System

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.

ErrorMessage is set to:

The {0} must be at least {2} characters long but no longer than {1} characters.

StringLengthAttribute ( string errorMessage, int maximumLength ) : System

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.

StringLengthAttribute ( string errorMessage, int maximumLength, int minLenght ) : System

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.

Method Details

FormatErrorMessage() public method

Applies formatting to a specified error message.
public FormatErrorMessage ( string name ) : string
name string The name of the field that caused the validation failure.
return string

StringLengthAttribute() public method

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.

ErrorMessage is set to:

The {0} must be at least {2} characters long.

public StringLengthAttribute ( int maximumLength ) : System
maximumLength int The maximum length of a string.
return System

StringLengthAttribute() public method

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.

ErrorMessage is set to:

The {0} must be at least {2} characters long but no longer than {1} characters.

public StringLengthAttribute ( int maximumLength, int minLength ) : System
maximumLength int The maximum length of a string.
minLength int The minimum length of the string.
return System

StringLengthAttribute() public method

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.
public StringLengthAttribute ( string errorMessage, int maximumLength ) : System
errorMessage string An error message to associate with a validation control if validation fails.
maximumLength int The maximum length of a string.
return System

StringLengthAttribute() public method

Initializes a new instance of the System.ComponentModel.DataAnnotations.StringLengthAttribute class by using a specified maximum length whose error message is localized.
public StringLengthAttribute ( string errorMessage, int maximumLength, int minLenght ) : System
errorMessage string An error message to associate with a validation control if validation fails.
maximumLength int The maximum length of a string.
minLenght int The minimum length of a string.
return System