49 types derived from ValidationAttribute
Microsoft.AspNetCore.Mvc.Core.Test (5)
ModelBinding\Metadata\ModelAttributesTest.cs (1)
369private class ClassValidator : ValidationAttribute
ModelBinding\ParameterBinderTest.cs (1)
876private class AlwaysInvalidAttribute : ValidationAttribute
ModelBinding\Validation\DefaultModelValidatorProviderTest.cs (1)
216private class CustomValidationAttribute : ValidationAttribute
ModelBinding\Validation\DefaultObjectValidatorTests.cs (2)
1622private class InvalidItemsAttribute : ValidationAttribute 1640private class InvalidPropertiesAttribute : ValidationAttribute
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (7)
DataAnnotationsClientModelValidatorProviderTest.cs (1)
140private class DummyValidationAttribute : ValidationAttribute
DataAnnotationsMetadataProviderTest.cs (1)
1761private class TestValidationAttribute : ValidationAttribute, IClientModelValidator
DataAnnotationsModelValidatorProviderTest.cs (3)
79private class DummyValidationAttribute : ValidationAttribute 230public class CustomNonRequiredAttribute1 : ValidationAttribute 234public class CustomNonRequiredAttribute2 : ValidationAttribute
DataAnnotationsModelValidatorTest.cs (1)
540public abstract class TestableValidationAttribute : ValidationAttribute
ValidationAttributeAdapterOfTAttributeTest.cs (1)
42public class TestValidationAttribute : ValidationAttribute
Microsoft.AspNetCore.Mvc.IntegrationTests (11)
CompanyNameAttribute.cs (1)
8public class CompanyNameAttribute : ValidationAttribute
ProductValidatorAttribute.cs (1)
8public class ProductValidatorAttribute : ValidationAttribute
TryValidateModelIntegrationTest.cs (1)
180private class ModelLevelErrorAttribute : ValidationAttribute
ValidationIntegrationTests.cs (4)
887private class ValidatePerson8Attribute : ValidationAttribute 994private class ValidateProducts9Attribute : ValidationAttribute 1307private class NeverValidAttribute : ValidationAttribute 2123private class ConsistentMinLength : ValidationAttribute
ValidationWithRecordIntegrationTests.cs (4)
756private class ValidatePerson8Attribute : ValidationAttribute 856private class ValidateProducts9Attribute : ValidationAttribute 1157private class NeverValidAttribute : ValidationAttribute 1914private class ConsistentMinLength : 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
122 references to ValidationAttribute
FormatterWebSite (4)
Models\ValidationProviderAttributeModel.cs (4)
21public override IEnumerable<ValidationAttribute> GetValidationAttributes() 23return new List<ValidationAttribute> 34public override IEnumerable<ValidationAttribute> GetValidationAttributes() 36return new List<ValidationAttribute>
HtmlGenerationWebSite (4)
Models\ValidationProviderAttributeModel.cs (4)
21public override IEnumerable<ValidationAttribute> GetValidationAttributes() 23return new List<ValidationAttribute> 34public override IEnumerable<ValidationAttribute> GetValidationAttributes() 36return new List<ValidationAttribute>
Microsoft.AspNetCore.Mvc.Core.Test (6)
ModelBinding\Validation\ClientValidatorCacheTest.cs (2)
134var attribute = validatorItem.ValidatorMetadata as ValidationAttribute;
ModelBinding\Validation\ValidatorCacheTest.cs (4)
23var attribute1 = Assert.IsType<DataAnnotationsModelValidator>(validators1[0]).Attribute; 24var attribute2 = Assert.IsType<DataAnnotationsModelValidator>(validators1[1]).Attribute; 86var attribute = validatorItem.ValidatorMetadata as ValidationAttribute;
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.DataAnnotations.Test (15)
DataAnnotationsMetadataProviderTest.cs (4)
1448attributes: new List<ValidationAttribute> 1896private readonly IEnumerable<ValidationAttribute> _attributes; 1898public FooCompositeValidationAttribute(IEnumerable<ValidationAttribute> attributes) 1903public override IEnumerable<ValidationAttribute> GetValidationAttributes()
DataAnnotationsModelValidatorTest.cs (5)
131var attribute = new Mock<ValidationAttribute> { CallBase = true }; 160var attribute = new Mock<ValidationAttribute> { CallBase = true }; 441public static TheoryData<ValidationAttribute, string, object[]> Validate_AttributesIncludeValues 449return new TheoryData<ValidationAttribute, string, object[]> 511ValidationAttribute attribute,
ValidationAttributeAdapterProviderTest.cs (6)
13public static TheoryData<ValidationAttribute, Type> DataAnnotationAdapters 17return new TheoryData<ValidationAttribute, Type> 54ValidationAttribute attribute, 64public static TheoryData<ValidationAttribute, string> DataTypeAdapters 68return new TheoryData<ValidationAttribute, string> { 80ValidationAttribute attribute,
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.AspNetCore.OpenApi (3)
Extensions\JsonNodeSchemaExtensions.cs (2)
308var attributes = validations.OfType<ValidationAttribute>(); 322if (parameterInfo.GetCustomAttributes().OfType<ValidationAttribute>() is { } validationAttributes)
Services\Schemas\OpenApiSchemaService.cs (1)
109if (attributeProvider.GetCustomAttributes(inherit: false).OfType<ValidationAttribute>() is { } validationAttributes)
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)
169/// 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) 554ValidationContext validationContext, IEnumerable<ValidationAttribute> attributes, bool breakOnFirstError) 563foreach (ValidationAttribute attribute in attributes) 578foreach (ValidationAttribute attr in attributes) 598/// Tests whether a value is valid against a single <see cref="ValidationAttribute" /> using the 610private static bool TryValidate(object? value, ValidationContext validationContext, ValidationAttribute attribute, 633private readonly ValidationAttribute? _validationAttribute; 635internal 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))]