Class MinItemsValidationRule
Validates whether collection satisfies the MinItems limit.
public sealed class MinItemsValidationRule : ValidationRule<MinItemsValidationRuleProperties, MinItemsValidationRuleClientProperties, IEnumerable>, IValidationRule
- Inheritance
-
objectValidationRule<MinItemsValidationRuleProperties, MinItemsValidationRuleClientProperties, IEnumerable>MinItemsValidationRule
- Implements
- Inherited Members
- Extension Methods
Constructors
MinItemsValidationRule(Func<IEnumerable>, ILocalizationService)
Creates a new instance of MinItemsValidationRule class.
public MinItemsValidationRule(Func<IEnumerable> valueProvider, ILocalizationService localizationService)
Parameters
valueProvider
Func<IEnumerable>Delegate to provide value.
localizationService
ILocalizationServiceLocalization service.
Properties
ClientRuleName
Gets the client rule name identifier.
public override string ClientRuleName { get; }
Property Value
- string
DefaultErrorMessage
Defines default error message of the validation rule.
protected override string DefaultErrorMessage { get; }
Property Value
- string
Methods
ConfigureClientProperties(MinItemsValidationRuleClientProperties)
Allows set validation rule client properties.
protected override Task ConfigureClientProperties(MinItemsValidationRuleClientProperties clientProperties)
Parameters
clientProperties
MinItemsValidationRuleClientPropertiesCurrent instance of client properties.
Returns
- Task
Validate(IEnumerable, IFormFieldValueProvider)
Validates whether value
's item count is more than or equal to MinItems.
public override Task<ValidationResult> Validate(IEnumerable value, IFormFieldValueProvider formFieldValueProvider)
Parameters
value
IEnumerableValue to be validated.
formFieldValueProvider
IFormFieldValueProviderProvider of values of other form fields for contextual validation.
Returns
- Task<ValidationResult>
Returns the validation result.
Remarks
Null value is treated as valid result.