Class DataAnnotationsValidator<T>
Base class for validator classes that does validation against attributes specified in System.ComponentModel.DataAnnotations
Namespace: EPiServer.Validation
Assembly: EPiServer.Framework.dll
Version: 12.0.3Syntax
public abstract class DataAnnotationsValidator<T> : Object, IValidate<T>, IValidateType Parameters
| Name | Description | 
|---|---|
| T | 
Constructors
DataAnnotationsValidator()
Initializes a new instance of the DataAnnotationsValidator<T> class.
Declaration
protected DataAnnotationsValidator()DataAnnotationsValidator(LocalizationService)
Initializes a new instance of the DataAnnotationsValidator<T> class.
Declaration
protected DataAnnotationsValidator(LocalizationService localizationService)Parameters
| Type | Name | Description | 
|---|---|---|
| LocalizationService | localizationService | 
Properties
IgnoredAttributes
Gets or sets attribute type that should not be part of validation.
Declaration
public virtual IEnumerable<Type> IgnoredAttributes { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<System.Type> | The ignored attributes. | 
Remarks
Default implementation returns empty enumeration.
Methods
GetDisplayName(PropertyDescriptor, Object)
Gets the display name for the propertyDescriptor on instance.
Declaration
protected virtual string GetDisplayName(PropertyDescriptor propertyDescriptor, object instance)Parameters
| Type | Name | Description | 
|---|---|---|
| System.ComponentModel.PropertyDescriptor | propertyDescriptor | The property to get the display name for. | 
| System.Object | instance | The object instance that  | 
Returns
| Type | Description | 
|---|---|
| System.String | A translated display name if any translation exists. | 
Validate(T)
Validates the specified instance.
Declaration
public virtual IEnumerable<ValidationError> Validate(T instance)Parameters
| Type | Name | Description | 
|---|---|---|
| T | instance | The instance. | 
Returns
| Type | Description | 
|---|---|
| System.Collections.Generic.IEnumerable<ValidationError> | 
