Class PropertyValidationService
Provides property validation functionality for content, media, and member properties.
Inheritance
object
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public class PropertyValidationService : IPropertyValidationService
Constructors
View SourcePropertyValidationService(PropertyEditorCollection, IDataTypeService, ILocalizedTextService, IValueEditorCache, ICultureDictionary, ILanguageService, IOptions<ContentSettings>)
Initializes a new instance of the PropertyValidationService class.
Declaration
public PropertyValidationService(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, ILocalizedTextService textService, IValueEditorCache valueEditorCache, ICultureDictionary cultureDictionary, ILanguageService languageService, IOptions<ContentSettings> contentSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| PropertyEditorCollection | propertyEditors | The collection of property editors. |
| IDataTypeService | dataTypeService | The data type service for retrieving data types. |
| ILocalizedTextService | textService | The localized text service for retrieving validation messages. |
| IValueEditorCache | valueEditorCache | The value editor cache for caching value editors. |
| ICultureDictionary | cultureDictionary | The culture dictionary for translating validation messages. |
| ILanguageService | languageService | The language service for language operations. |
| IOptions<ContentSettings> | contentSettings | The content settings options. |
Methods
View SourceIsPropertyDataValid(IContent, out IProperty[], CultureImpact?)
Validates the content item's properties pass validation rules
Declaration
public bool IsPropertyDataValid(IContent content, out IProperty[] invalidProperties, CultureImpact? impact)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| IProperty[] | invalidProperties | |
| CultureImpact | impact |
Returns
| Type | Description |
|---|---|
| bool |
IsPropertyValid(IProperty, PropertyValidationContext)
Gets a value indicating whether the property has valid values.
Declaration
public bool IsPropertyValid(IProperty property, PropertyValidationContext validationContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IProperty | property | |
| PropertyValidationContext | validationContext |
Returns
| Type | Description |
|---|---|
| bool |
ValidatePropertyValue(IPropertyType, object?, PropertyValidationContext)
Validates a property value.
Declaration
public IEnumerable<ValidationResult> ValidatePropertyValue(IPropertyType propertyType, object? postedValue, PropertyValidationContext validationContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IPropertyType | propertyType | |
| object | postedValue | |
| PropertyValidationContext | validationContext |
Returns
| Type | Description |
|---|---|
| IEnumerable<ValidationResult> |
ValidatePropertyValue(IDataEditor, IDataType, object?, bool, string?, string?, string?, PropertyValidationContext)
Validates a property value.
Declaration
public IEnumerable<ValidationResult> ValidatePropertyValue(IDataEditor editor, IDataType dataType, object? postedValue, bool isRequired, string? validationRegExp, string? isRequiredMessage, string? validationRegExpMessage, PropertyValidationContext validationContext)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataEditor | editor | |
| IDataType | dataType | |
| object | postedValue | |
| bool | isRequired | |
| string | validationRegExp | |
| string | isRequiredMessage | |
| string | validationRegExpMessage | |
| PropertyValidationContext | validationContext |
Returns
| Type | Description |
|---|---|
| IEnumerable<ValidationResult> |