C# Class System.ComponentModel.DataAnnotations.FileExtensionsAttribute

Inheritance: System.ComponentModel.DataAnnotations.DataTypeAttribute
Afficher le fichier Open project: adaptabi/i18N-Complete Class Usage Examples

Méthodes publiques

Méthode Description
FileExtensionsAttribute ( string allowedExtensions = "png,jpg,jpeg,gif" ) : System

Provide the allowed file extensions, seperated via "|" (or a comma, ","), defaults to "png|jpe?g|gif" with the defaul error message "The {0} field only accepts files with the following extensions: {1}

FileExtensionsAttribute ( string errorMessage, string allowedExtensions ) : System

Provide the allowed file extensions, seperated via "|" (or a comma, ","), defaults to "png|jpe?g|gif"

FormatErrorMessage ( string name ) : string

Applies formatting to an error message, based on the data field where the error occurred.

IsValid ( object value ) : bool

Determines whether the specified value of the object is valid.

Private Methods

Méthode Description
ValidateExtension ( string fileName ) : bool

Method Details

FileExtensionsAttribute() public méthode

Provide the allowed file extensions, seperated via "|" (or a comma, ","), defaults to "png|jpe?g|gif" with the defaul error message "The {0} field only accepts files with the following extensions: {1}
public FileExtensionsAttribute ( string allowedExtensions = "png,jpg,jpeg,gif" ) : System
allowedExtensions string Specify the allowe dextensions separated by | or comma ,
Résultat System

FileExtensionsAttribute() public méthode

Provide the allowed file extensions, seperated via "|" (or a comma, ","), defaults to "png|jpe?g|gif"
public FileExtensionsAttribute ( string errorMessage, string allowedExtensions ) : System
errorMessage string Specify a custom error message to be translated
allowedExtensions string Specify the allowe dextensions separated by | or comma ,
Résultat System

FormatErrorMessage() public méthode

Applies formatting to an error message, based on the data field where the error occurred.
public FormatErrorMessage ( string name ) : string
name string The name to include in the formatted message.
Résultat string

IsValid() public méthode

Determines whether the specified value of the object is valid.
public IsValid ( object value ) : bool
value object The value of the object to validate.
Résultat bool