Method | Description | |
---|---|---|
Compile ( |
Parses and compiles expression provided to the attribute. Compiled lambda is then cached and used for validation purposes.
|
|
Equals ( object obj ) : bool |
Determines whether the specified System.Object, is equal to this instance.
|
|
FormatErrorMessage ( string displayName, string expression, |
Formats the error message for client (value indicators not resolved - replaced by guids to be dynamically extracted by client-code). This method interprets custom format specifiers, provided to error message string, for which values or display names of model fields are extracted. Specifiers should be given in braces (curly brackets), i.e. {fieldPath[:indicator]}, e.g. {field}, {field.field:n}. Braces can be escaped by double-braces, i.e. to output a { use {{ and to output a } use }}. |
|
FormatErrorMessage ( string displayName, string expression, object objectInstance ) : string |
Formats the error message for user. This method interprets custom format specifiers, provided to error message string, for which values or display names of model fields are extracted. Specifiers should be given in braces (curly brackets), i.e. {fieldPath[:indicator]}, e.g. {field}, {field.field:n}. Braces can be escaped by double-braces, i.e. to output a { use {{ and to output a } use }}. |
|
GetHashCode ( ) : int |
Returns a hash code for this instance.
|
|
GetPriority ( ) : int? |
Gets the value of Priority if it has been set, or
|
|
ToString ( ) : string |
Returns a System.String that represents this instance.
|
Method | Description | |
---|---|---|
ExpressiveAttribute ( string expression, Func |
Constructor for expressive validation attribute. Allows for providing a resource accessor function that will be used to retrieve the error message. An example would be to have something like, e.g. CustomAttribute() : base( () => MyResources.MyErrorMessage ) {}. |
|
ExpressiveAttribute ( string expression, string errorMessage ) : System |
Constructor for expressive validation attribute.
|
|
IsValid ( object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext ) : System.ComponentModel.DataAnnotations.ValidationResult |
Validates a specified value with respect to the associated validation attribute.
|
|
IsValidInternal ( object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext ) : System.ComponentModel.DataAnnotations.ValidationResult |
Validates a specified value with respect to the associated validation attribute. Internally used by the ExpressiveAttribute.IsValid(object,System.ComponentModel.DataAnnotations.ValidationContext) method.
|
Method | Description | |
---|---|---|
AdjustMemberName ( System.ComponentModel.DataAnnotations.ValidationContext validationContext ) : void | ||
PreformatMessage ( string displayName, string expression, IList |
public Compile ( |
||
validationContextType | The type of the object to be validated. | |
force | bool | Flag indicating whether parsing should be rerun despite the fact compiled lambda already exists. |
return | void |
public Equals ( object obj ) : bool | ||
obj | object | The |
return | bool |
protected ExpressiveAttribute ( string expression, Func |
||
expression | string | The logical expression based on which specified condition is computed. |
errorMessageAccessor | Func |
The error message accessor, allowing the error message to be provided dynamically. |
return | System |
protected ExpressiveAttribute ( string expression, string errorMessage ) : System | ||
expression | string | The logical expression based on which specified condition is computed. |
errorMessage | string | The error message to associate with a validation control. |
return | System |
public FormatErrorMessage ( string displayName, string expression, |
||
displayName | string | The user-visible name of the required field to include in the formatted message. |
expression | string | The user-visible expression to include in the formatted message. |
objectType | The annotated field declaring container type. | |
fieldsMap | Guid>.IDictionary | The map containing fields names for which values should be extracted by client-side. |
return | string |
public FormatErrorMessage ( string displayName, string expression, object objectInstance ) : string | ||
displayName | string | The user-visible name of the required field to include in the formatted message. |
expression | string | The user-visible expression to include in the formatted message. |
objectInstance | object | The anotated field declaring container instance. |
return | string |
protected IsValid ( object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext ) : System.ComponentModel.DataAnnotations.ValidationResult | ||
value | object | The value to validate. |
validationContext | System.ComponentModel.DataAnnotations.ValidationContext | The validation context. |
return | System.ComponentModel.DataAnnotations.ValidationResult |
protected abstract IsValidInternal ( object value, System.ComponentModel.DataAnnotations.ValidationContext validationContext ) : System.ComponentModel.DataAnnotations.ValidationResult | ||
value | object | The value to validate. |
validationContext | System.ComponentModel.DataAnnotations.ValidationContext | The validation context. |
return | System.ComponentModel.DataAnnotations.ValidationResult |