Class ImageValidator
Base class with utility methods for validator implementations.
Inherited Members
Namespace: AdaptiveImages.Validation
Assembly: AdaptiveImages.dll
Syntax
public abstract class ImageValidator
Constructors
ImageValidator(IContentLoader?, LocalizationService?, IPublishedStateAssessor?, IAddonSettings?)
Creates a new validator for content with image properties.
Declaration
public ImageValidator(IContentLoader? contentLoader = null, LocalizationService? localizationService = null, IPublishedStateAssessor? publishedStateAssessor = null, IAddonSettings? addonSettings = null)
Parameters
Type | Name | Description |
---|---|---|
IContentLoader | contentLoader | |
LocalizationService | localizationService | |
IPublishedStateAssessor | publishedStateAssessor | |
IAddonSettings | addonSettings |
Methods
GetImageProperties<TImageProperty>(IContentData)
Gets image properties, if any, of the specified type for a content instance.
Declaration
protected virtual IEnumerable<(PropertyInfo property, IContentData parent)> GetImageProperties<TImageProperty>(IContentData parent) where TImageProperty : BlockData
Parameters
Type | Name | Description |
---|---|---|
IContentData | parent | The instance to recursively check for image properties of the specified type. |
Returns
Type | Description |
---|---|
IEnumerable<(PropertyInfo property, IContentData parent)> | All image properties of the specified type, paired with the actual parent content (applicable when image property is nested in a local block) |
Type Parameters
Name | Description |
---|---|
TImageProperty |
Validate<TImageProperty>(IContentData)
Validates any image properties of the specified type on the content instance.
Declaration
protected virtual IEnumerable<ValidationError> Validate<TImageProperty>(IContentData instance) where TImageProperty : BlockData
Parameters
Type | Name | Description |
---|---|---|
IContentData | instance | Content instance, such as a page or block. |
Returns
Type | Description |
---|---|
IEnumerable<ValidationError> | Validation errors, if any. |
Type Parameters
Name | Description |
---|---|
TImageProperty |