26 types derived from ValidationAttribute
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
RemoteAttributeBase.cs (1)
26public abstract class RemoteAttributeBase : ValidationAttribute, IClientModelValidator
Microsoft.Extensions.Compliance.Redaction (2)
src\Shared\Data.Validation\LengthAttribute.cs (1)
29internal sealed class LengthAttribute : ValidationAttribute
src\Shared\Data.Validation\TimeSpanAttribute.cs (1)
23internal sealed class TimeSpanAttribute : ValidationAttribute
Microsoft.Extensions.Diagnostics.Probes (2)
src\Shared\Data.Validation\LengthAttribute.cs (1)
29internal sealed class LengthAttribute : ValidationAttribute
src\Shared\Data.Validation\TimeSpanAttribute.cs (1)
23internal sealed class TimeSpanAttribute : ValidationAttribute
Microsoft.Extensions.Diagnostics.ResourceMonitoring (2)
src\Shared\Data.Validation\LengthAttribute.cs (1)
29internal sealed class LengthAttribute : ValidationAttribute
src\Shared\Data.Validation\TimeSpanAttribute.cs (1)
23internal sealed class TimeSpanAttribute : ValidationAttribute
Microsoft.Extensions.Http.Resilience (2)
src\Shared\Data.Validation\LengthAttribute.cs (1)
29internal sealed class LengthAttribute : ValidationAttribute
src\Shared\Data.Validation\TimeSpanAttribute.cs (1)
23internal sealed class TimeSpanAttribute : ValidationAttribute
Microsoft.Extensions.Telemetry (2)
src\Shared\Data.Validation\LengthAttribute.cs (1)
29internal sealed class LengthAttribute : ValidationAttribute
src\Shared\Data.Validation\TimeSpanAttribute.cs (1)
23internal sealed class TimeSpanAttribute : ValidationAttribute
Shared (2)
Data.Validation\LengthAttribute.cs (1)
29internal sealed class LengthAttribute : ValidationAttribute
Data.Validation\TimeSpanAttribute.cs (1)
23internal sealed class TimeSpanAttribute : ValidationAttribute
System.ComponentModel.Annotations (13)
System\ComponentModel\DataAnnotations\AllowedValuesAttribute.cs (1)
12public class AllowedValuesAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\Base64StringAttribute.cs (1)
16public class Base64StringAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\CompareAttribute.cs (1)
12public class CompareAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\CustomValidationAttribute.cs (1)
58public sealed class CustomValidationAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\DataTypeAttribute.cs (1)
16public class DataTypeAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\DeniedValuesAttribute.cs (1)
12public class DeniedValuesAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\LengthAttribute.cs (1)
13public class LengthAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\MaxLengthAttribute.cs (1)
17public class MaxLengthAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\MinLengthAttribute.cs (1)
14public class MinLengthAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\RangeAttribute.cs (1)
14public class RangeAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\RegularExpressionAttribute.cs (1)
15public class RegularExpressionAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\RequiredAttribute.cs (1)
11public class RequiredAttribute : ValidationAttribute
System\ComponentModel\DataAnnotations\StringLengthAttribute.cs (1)
13public class StringLengthAttribute : ValidationAttribute
130 references to ValidationAttribute
Microsoft.AspNetCore.Components.Forms (9)
ClientValidation\DefaultClientValidationService.cs (7)
18/// Generates <c>data-val-*</c> HTML attributes from <see cref="ValidationAttribute"/>s on model properties. 50foreach (var validationAttribute in metadata.ValidationAttributes) 69ValidationAttribute validationAttribute, 234ValidationAttribute attribute, 257ValidationAttribute[] validationAttributes, 269public ValidationAttribute[] ValidationAttributes { get; } = validationAttributes; 289var validationAttributes = property.GetCustomAttributes<ValidationAttribute>(inherit: true).ToArray();
ClientValidation\IClientValidationAdapter.cs (1)
7/// Implemented by <see cref="System.ComponentModel.DataAnnotations.ValidationAttribute"/> subclasses
ClientValidation\IClientValidationService.cs (1)
8/// based on their <see cref="System.ComponentModel.DataAnnotations.ValidationAttribute"/>s.
Microsoft.AspNetCore.Mvc.DataAnnotations (25)
AttributeAdapterBase.cs (3)
14/// <typeparam name="TAttribute">The type of <see cref="ValidationAttribute"/> which is being wrapped.</typeparam> 18where TAttribute : ValidationAttribute 23/// <param name="attribute">The <see cref="ValidationAttribute"/> being wrapped.</param>
DataAnnotationsClientModelValidatorProvider.cs (3)
13/// for attributes which derive from <see cref="ValidationAttribute"/>. It also provides 73var attribute = validatorItem.ValidatorMetadata as ValidationAttribute;
DataAnnotationsMetadataProvider.cs (2)
378foreach (var attribute in attributes.OfType<ValidationAttribute>())
DataAnnotationsModelValidator.cs (5)
12/// Validates based on the given <see cref="ValidationAttribute"/>. 23/// <param name="attribute">The <see cref="ValidationAttribute"/> that defines what we're validating.</param> 29ValidationAttribute attribute, 43public ValidationAttribute Attribute { get; } 46/// Validates the context against the <see cref="ValidationAttribute"/>.
DataAnnotationsModelValidatorProvider.cs (3)
13/// for attributes which derive from <see cref="ValidationAttribute"/>. It also provides 65if (!(validatorItem.ValidatorMetadata is ValidationAttribute attribute)) 108if (validatorMetadata[i] is ValidationAttribute)
IValidationAttributeAdapterProvider.cs (3)
15/// Returns the <see cref="IAttributeAdapter"/> for the given <see cref=" ValidationAttribute"/>. 17/// <param name="attribute">The <see cref="ValidationAttribute"/> to create an <see cref="IAttributeAdapter"/> 22IAttributeAdapter? GetAttributeAdapter(ValidationAttribute attribute, IStringLocalizer? stringLocalizer);
ValidationAttributeAdapterOfTAttribute.cs (1)
16where TAttribute : ValidationAttribute
ValidationAttributeAdapterProvider.cs (1)
20public IAttributeAdapter? GetAttributeAdapter(ValidationAttribute attribute, IStringLocalizer? stringLocalizer)
ValidationProviderAttribute.cs (4)
9/// Abstract class for grouping attributes of type <see cref="ValidationAttribute"/> into 15/// Gets <see cref="ValidationAttribute" /> instances associated with this attribute. 17/// <returns>Sequence of <see cref="ValidationAttribute" /> associated with this attribute.</returns> 18public abstract IEnumerable<ValidationAttribute> GetValidationAttributes();
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
RemoteAttributeBase.cs (3)
21/// A <see cref="ValidationAttribute"/> which configures Unobtrusive validation to send an Ajax request to the 124/// Always returns <c>true</c> since this <see cref="ValidationAttribute"/> does no validation itself. 139/// Calls derived <see cref="ValidationAttribute"/> implementation of <see cref="GetUrl(ClientModelValidationContext)"/>.
Microsoft.Extensions.Validation (18)
ErrorMessageLocalizationContext.cs (1)
33public required ValidationAttribute Attribute { get; init; }
IValidationLocalizer.cs (1)
9/// localized error message text for <see cref="System.ComponentModel.DataAnnotations.ValidationAttribute"/>
RuntimeValidatableParameterInfoResolver.cs (4)
41.GetCustomAttributes<ValidationAttribute>() 96ValidationAttribute[] validationAttributes) : 99protected override ValidationAttribute[] GetValidationAttributes() => _validationAttributes; 101private readonly ValidationAttribute[] _validationAttributes = validationAttributes;
TypeExtensions.cs (3)
69/// <param name="attributes">The array of <see cref="ValidationAttribute"/> to search.</param> 72public static bool TryGetRequiredAttribute(this ValidationAttribute[] attributes, [NotNullWhen(true)] out RequiredAttribute? requiredAttribute) 74foreach (var attribute in attributes)
ValidatableParameterInfo.cs (2)
56protected abstract ValidationAttribute[] GetValidationAttributes(); 104var attribute = validationAttributes[i];
ValidatablePropertyInfo.cs (3)
65protected abstract ValidationAttribute[] GetValidationAttributes(); 173void ValidateValue(object? val, string name, string errorPrefix, ValidationAttribute[] validationAttributes, object? container) 177var attribute = validationAttributes[i];
ValidatableTypeInfo.cs (2)
44protected abstract ValidationAttribute[] GetValidationAttributes(); 206var attribute = validationAttributes[i];
ValidateContext.cs (2)
16/// Gets or sets the validation context used for validating objects that implement <see cref="IValidatableObject"/> or have <see cref="ValidationAttribute"/>. 139ValidationAttribute attribute,
Microsoft.Extensions.Validation.Localization (13)
ValidationAttributeFormatterRegistry.cs (4)
10/// <see cref="ValidationAttribute"/> type. Used by the validation localization pipeline 53private readonly Dictionary<Type, Func<ValidationAttribute, IValidationAttributeFormatter>> _factories = []; 89where TAttribute : ValidationAttribute 106public IValidationAttributeFormatter? GetFormatter(ValidationAttribute attribute)
ValidationLocalizationOptions.cs (9)
67/// every attribute and takes precedence over <see cref="ValidationAttribute.ErrorMessage"/>. 69/// <see cref="ValidationAttribute.ErrorMessage"/> directly as the lookup key. 74/// <see cref="ValidationAttribute.ErrorMessage"/> set are localized (using the 75/// <see cref="ValidationAttribute.ErrorMessage"/> value as the key); attributes without 76/// an explicit <see cref="ValidationAttribute.ErrorMessage"/> are not localized at all. 83/// <see cref="ValidationAttribute.ErrorMessage"/> (convention-based key selection).</item> 84/// <item>Transform an existing <see cref="ValidationAttribute.ErrorMessage"/> into a 87/// <see cref="ValidationAttribute.ErrorMessage"/> from the context.</item> 89/// behavior of using <see cref="ValidationAttribute.ErrorMessage"/> as the key.</item>
System.ComponentModel.Annotations (61)
System\ComponentModel\DataAnnotations\AllowedValuesAttribute.cs (1)
33/// Determines whether a specified object is valid. (Overrides <see cref="ValidationAttribute.IsValid(object)" />)
System\ComponentModel\DataAnnotations\Base64StringAttribute.cs (1)
29/// Determines whether a specified object is valid. (Overrides <see cref="ValidationAttribute.IsValid(object)" />)
System\ComponentModel\DataAnnotations\CustomValidationAttribute.cs (5)
26/// Like any other <see cref="ValidationAttribute" />, its <see cref="IsValid(object, ValidationContext)" /> 51/// then the normal <see cref="ValidationAttribute.FormatErrorMessage" /> method will be called to compose the 80/// and <see cref="ValidationAttribute.FormatErrorMessage" /> to return a summary error message. 128/// Override of validation method. See <see cref="ValidationAttribute.IsValid(object, ValidationContext)" />. 188/// Override of <see cref="ValidationAttribute.FormatErrorMessage" />
System\ComponentModel\DataAnnotations\DataTypeAttribute.cs (1)
98/// Override of <see cref="ValidationAttribute.IsValid(object)" />
System\ComponentModel\DataAnnotations\DeniedValuesAttribute.cs (1)
33/// Determines whether a specified object is valid. (Overrides <see cref="ValidationAttribute.IsValid(object)" />)
System\ComponentModel\DataAnnotations\LengthAttribute.cs (2)
34/// Determines whether a specified object is valid. (Overrides <see cref="ValidationAttribute.IsValid(object)" />) 74/// Applies formatting to a specified error message. (Overrides <see cref="ValidationAttribute.FormatErrorMessage" />)
System\ComponentModel\DataAnnotations\MaxLengthAttribute.cs (2)
54/// Determines whether a specified object is valid. (Overrides <see cref="ValidationAttribute.IsValid(object)" />) 91/// Applies formatting to a specified error message. (Overrides <see cref="ValidationAttribute.FormatErrorMessage" />)
System\ComponentModel\DataAnnotations\MinLengthAttribute.cs (2)
36/// Determines whether a specified object is valid. (Overrides <see cref="ValidationAttribute.IsValid(object)" />) 74/// Applies formatting to a specified error message. (Overrides <see cref="ValidationAttribute.FormatErrorMessage" />)
System\ComponentModel\DataAnnotations\RangeAttribute.cs (1)
173/// Override of <see cref="ValidationAttribute.FormatErrorMessage" />
System\ComponentModel\DataAnnotations\RegularExpressionAttribute.cs (2)
47/// Override of <see cref="ValidationAttribute.IsValid(object)" /> 80/// Override of <see cref="ValidationAttribute.FormatErrorMessage" />
System\ComponentModel\DataAnnotations\RequiredAttribute.cs (2)
18/// <see cref="ValidationAttribute.FormatErrorMessage" /> 31/// Override of <see cref="ValidationAttribute.IsValid(object)" />
System\ComponentModel\DataAnnotations\StringLengthAttribute.cs (2)
36/// Override of <see cref="ValidationAttribute.IsValid(object)" /> 62/// Override of <see cref="ValidationAttribute.FormatErrorMessage" />
System\ComponentModel\DataAnnotations\ValidationAttribute.cs (1)
453/// can provide additional context to the <see cref="ValidationAttribute" /> being validated.
System\ComponentModel\DataAnnotations\ValidationAttributeStore.cs (5)
14/// Cache of <see cref="ValidationAttribute" />s 36internal IEnumerable<ValidationAttribute> GetTypeValidationAttributes(ValidationContext validationContext) 62internal IEnumerable<ValidationAttribute> GetPropertyValidationAttributes(ValidationContext validationContext) 152ValidationAttributes = attributes.OfType<ValidationAttribute>(); 156internal IEnumerable<ValidationAttribute> ValidationAttributes { get; }
System\ComponentModel\DataAnnotations\ValidationException.cs (3)
24public ValidationException(ValidationResult validationResult, ValidationAttribute? validatingAttribute, 37public ValidationException(string? errorMessage, ValidationAttribute? validatingAttribute, object? value) 88public ValidationAttribute? ValidationAttribute { get; }
System\ComponentModel\DataAnnotations\ValidationResult.cs (7)
14/// <seealso cref="ValidationAttribute.GetValidationResult" /> 34/// provided on the <see cref="ValidationAttribute" />. 37/// The user-visible error message. If null, <see cref="ValidationAttribute.GetValidationResult" /> 38/// will use <see cref="ValidationAttribute.FormatErrorMessage" /> for its error message. 47/// This error message would override any error message provided on the <see cref="ValidationAttribute" />. 50/// The user-visible error message. If null, <see cref="ValidationAttribute.GetValidationResult" /> 51/// will use <see cref="ValidationAttribute.FormatErrorMessage" /> for its error message.
System\ComponentModel\DataAnnotations\Validator.cs (23)
13/// <see cref="ValidationAttribute" /> 24/// This method will test each <see cref="ValidationAttribute" /> associated with the property 76/// This method evaluates all <see cref="ValidationAttribute" />s attached to the object instance's type. It also 103/// This method evaluates all <see cref="ValidationAttribute" />s attached to the object instance's type. It also 106/// is <c>true</c>, this method will also evaluate the <see cref="ValidationAttribute" />s for all the immediate 157/// Tests whether the given value is valid against a specified list of <see cref="ValidationAttribute" />s. 160/// This method will test each <see cref="ValidationAttribute" />s specified. If 181/// The list of <see cref="ValidationAttribute" />s to validate this 186ICollection<ValidationResult>? validationResults, IEnumerable<ValidationAttribute> validationAttributes) 235/// This method evaluates all <see cref="ValidationAttribute" />s attached to the object's type. 259/// This method evaluates all <see cref="ValidationAttribute" />s attached to the object's type. 296/// <see cref="ValidationAttribute" />s. 299/// This method evaluates the <see cref="ValidationAttribute" />s supplied until a validation error occurs, 308/// <param name="validationAttributes">The list of <see cref="ValidationAttribute" />s to validate against this instance.</param> 312IEnumerable<ValidationAttribute> validationAttributes) 480foreach (ValidationAttribute attribute in attributes) 553ValidationContext validationContext, IEnumerable<ValidationAttribute> attributes, bool breakOnFirstError) 562foreach (ValidationAttribute attribute in attributes) 577foreach (ValidationAttribute attr in attributes) 597/// Tests whether a value is valid against a single <see cref="ValidationAttribute" /> using the 609private static bool TryValidate(object? value, ValidationContext validationContext, ValidationAttribute attribute, 632private readonly ValidationAttribute? _validationAttribute; 634internal ValidationError(ValidationAttribute? validationAttribute, object? value,
System.ComponentModel.DataAnnotations (1)
System.ComponentModel.DataAnnotations.cs (1)
42[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.DataAnnotations.ValidationAttribute))]