Search Results for

    Show / Hide Table of Contents
    View Source

    Class ValueListUniqueValueValidator

    Represents a validator which ensures that all values in the list are unique.

    Inheritance
    object
    Namespace: Umbraco.Cms.Core.PropertyEditors
    Assembly: Umbraco.Infrastructure.dll
    Syntax
    public class ValueListUniqueValueValidator : IValueValidator

    Constructors

    View Source

    ValueListUniqueValueValidator(IConfigurationEditorJsonSerializer)

    Initializes a new instance of the ValueListUniqueValueValidator class.

    Declaration
    public ValueListUniqueValueValidator(IConfigurationEditorJsonSerializer configurationEditorJsonSerializer)
    Parameters
    Type Name Description
    IConfigurationEditorJsonSerializer configurationEditorJsonSerializer

    An instance used to serialize and deserialize configuration editor values as JSON.

    Methods

    View Source

    Validate(object?, string?, object?, PropertyValidationContext)

    Validates that all values in the provided list are unique.

    Declaration
    public IEnumerable<ValidationResult> Validate(object? value, string? valueType, object? dataTypeConfiguration, PropertyValidationContext validationContext)
    Parameters
    Type Name Description
    object value

    The value to validate, expected to be either an System.Collections.Generic.IEnumerable<T> or a JSON-serialized string array representing the list of values.

    string valueType

    The type of the value being validated (may be used for context).

    object dataTypeConfiguration

    The configuration object for the data type (may be used for context).

    PropertyValidationContext validationContext

    The context for property validation.

    Returns
    Type Description
    IEnumerable<ValidationResult>

    An System.Collections.Generic.IEnumerable<T> containing a System.ComponentModel.DataAnnotations.ValidationResult for each duplicate value found in the list; returns an error if the value cannot be parsed as a list. If all values are unique or the input is null, returns an empty sequence.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX