Class ConfigurationValidatorBase
Base class for configuration validators.
Inheritance
Namespace: Umbraco.Cms.Core.Configuration.Models.Validation
Assembly: Umbraco.Core.dll
Syntax
public abstract class ConfigurationValidatorBase
Methods
View SourceValidateCollection(String, IEnumerable<ValidatableEntryBase>, String, out String)
Validates that a collection of objects are all valid based on their data annotations.
Declaration
public bool ValidateCollection(string configPath, IEnumerable<ValidatableEntryBase> values, string validationDescription, out string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | configPath | Configuration path from where the setting is found. |
IEnumerable<ValidatableEntryBase> | values | The values to check. |
System.String | validationDescription | Description of validation appended to message if validation fails. |
System.String | message | A message to output if the value does not match. |
Returns
Type | Description |
---|---|
System.Boolean | True if valid, false if not. |
ValidateOptionalEntry(String, ValidatableEntryBase, String, out String)
Validates a configuration entry is valid if provided.
Declaration
public bool ValidateOptionalEntry(string configPath, ValidatableEntryBase value, string validationDescription, out string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | configPath | Configuration path from where the setting is found. |
ValidatableEntryBase | value | The value to check. |
System.String | validationDescription | Description of validation appended to message if validation fails. |
System.String | message | A message to output if the value does not match. |
Returns
Type | Description |
---|---|
System.Boolean | True if valid, false if not. |
ValidateStringIsOneOfValidValues(String, String, IEnumerable<String>, out String)
Validates that a string is one of a set of valid values.
Declaration
public bool ValidateStringIsOneOfValidValues(string configPath, string value, IEnumerable<string> validValues, out string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | configPath | Configuration path from where the setting is found. |
System.String | value | The value to check. |
IEnumerable<System.String> | validValues | The set of valid values. |
System.String | message | A message to output if the value does not match. |
Returns
Type | Description |
---|---|
System.Boolean | True if valid, false if not. |