Class DistinctListAttribute

System.ComponentModel.DataAnnotations.ValidationAttribute for preventing duplicate members in an System.Collections.Generic.IEnumerable<T> property.

Inheritance
System.Object
DistinctListAttribute
Namespace: EPiServer.Commerce.Marketing.DataAnnotations
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class DistinctListAttribute : ValidationAttribute

Constructors

DistinctListAttribute()

Initializes a new instance of a DistinctListAttribute using the default registered EPiServer.Framework.Localization.LocalizationService.

Declaration
public DistinctListAttribute()

DistinctListAttribute(LocalizationService)

Initializes a new instance of a DistinctListAttribute.

Declaration
public DistinctListAttribute(LocalizationService localizationService)
Parameters
Type Name Description
EPiServer.Framework.Localization.LocalizationService localizationService

Service for translating the validation error message.

Methods

FormatErrorMessage(String)

Declaration
public override string FormatErrorMessage(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
System.String

IsValid(Object)

Gets whether the property conforms to the validation rule or not.

Declaration
public override bool IsValid(object value)
Parameters
Type Name Description
System.Object value

The System.Collections.Generic.IEnumerable<T> property being validated.

Returns
Type Description
System.Boolean

True if valid, else false.