69 instantiations of RangeAttribute
BasicWebSite (1)
Models\Product.cs (1)
10[Range(10, 100)]
FormatterWebSite (7)
Controllers\JsonFormatterController.cs (1)
103[Range(1, 100)]
Controllers\TopLevelValidationController.cs (2)
18[BindProperty, Range(1, 100), DisplayName("Some Display Name For Prop")] public int OptionalRangeDisplayNameProp { get; set; } 35[Range(1, 100), Display(Name = "Some Display Name For Param")] int optionalRangeDisplayNameParam)
Models\Employee.cs (1)
10[Range(10, 100)]
Models\SimpleTypePropertiesModel.cs (2)
10[Range(2, 8)] 13[Range(2, 8)]
Models\User.cs (1)
13[Required, Range(1, 2000)]
HtmlGenerationWebSite (3)
Models\CustomerRecord.cs (1)
10[Range(1, 100)]
Models\Person.cs (1)
12[Range(1, 100)]
Models\Warehouse.cs (1)
17[Range(1, 100)]
IdentitySample.DefaultUI (2)
Areas\Identity\Pages\Account\Manage\Index.cshtml.cs (1)
45[Range(0, 199, ErrorMessage = "Age must be between 0 and 199")]
Areas\Identity\Pages\Account\Register.cshtml.cs (1)
65[Range(0, 199, ErrorMessage = "Age must be between 0 and 199 years")]
Microsoft.AspNetCore.Components.Forms.Tests (1)
EditContextDataAnnotationsExtensionsTest.cs (1)
187[Range(1, 100, ErrorMessage = "IntFrom1To100:range")] public int IntFrom1To100 { get; set; }
Microsoft.AspNetCore.HeaderParsing (1)
HeaderParsingOptions.cs (1)
33[Range(0, int.MaxValue)]
Microsoft.AspNetCore.Mvc.Core.Test (11)
Controllers\ControllerBinderDelegateProviderTest.cs (1)
1066[Range(25, 50)]
ModelBinding\Metadata\ModelAttributesTest.cs (5)
308[Range(10, 100)] 327[Range(10, 100)] 340[Range(0, 10)] 389[Range(0, 10)] 409[Required, Range(1, 100)] int validationAttributes,
ModelBinding\ParameterBinderTest.cs (1)
230var validationAttribute = new RangeAttribute(1, 100);
ModelBinding\Validation\DefaultModelValidatorProviderTest.cs (2)
212[Range(0, 10)] 228[Range(0, 10)]
ModelBinding\Validation\DefaultObjectValidatorTests.cs (2)
1593[Range(15, 25)] 1673[Range(-10, 400)]
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
ValidationAttributeUtil.cs (1)
35var attr = new RangeAttribute(min, max);
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (7)
DataAnnotationsModelValidatorTest.cs (1)
485new RangeAttribute(0, length) { ErrorMessage = LocalizationKey },
DefaultModelClientValidatorProviderTest.cs (2)
237[Range(0, 10)] 256[Range(0, 10)]
RangeAttributeAdapterTest.cs (3)
22var attribute = new RangeAttribute(typeof(decimal), "0", "100"); 52var attribute = new RangeAttribute(typeof(decimal), "0", "100"); 88var attribute = new RangeAttribute(typeof(decimal), "0", "100");
ValidationAttributeAdapterProviderTest.cs (1)
32new RangeAttribute(1, 100),
Microsoft.AspNetCore.Mvc.IntegrationTests (10)
DictionaryModelBinderIntegrationTest.cs (1)
465[Range(minimum: 0, maximum: 15, ErrorMessage = "You're out of range.")]
Models\Product.cs (1)
18[Range(0, 100)]
Models\ProductViewModel.cs (1)
16[Range(20, 100)]
Models\Software.cs (1)
15[Range(100, 200)]
ValidationIntegrationTests.cs (3)
26[Range(25, 50)] 1563[Range(0, 10)] 1710[Range(10000, 99999)]
ValidationWithRecordIntegrationTests.cs (3)
22private record TransferInfo([Range(25, 50)] int AccountId, double Amount); 1371[Range(0, 10)] 1516[Range(10000, 99999)]
Microsoft.AspNetCore.OpenApi.Tests (13)
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (12)
342[([Range(4, 8)]int id) => {}, (OpenApiSchema schema) => { Assert.Equal(4, schema.Minimum); Assert.Equal(8, schema.Maximum); }], 343[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }], 373[([Range(4, 8)] int id) => {}, (OpenApiSchema schema) => { Assert.Equal(4, schema.Minimum); Assert.Equal(8, schema.Maximum); }], 374[([Range(int.MinValue, int.MaxValue)] int id) => {}, (OpenApiSchema schema) => { Assert.Equal(int.MinValue, schema.Minimum); Assert.Equal(int.MaxValue, schema.Maximum); }], 375[([Range(0, double.MaxValue)] double id) => {}, (OpenApiSchema schema) => { Assert.Equal(0, schema.Minimum); Assert.Null(schema.Maximum); }], 376[([Range(typeof(double), "0", "1.79769313486232E+308")] double id) => {}, (OpenApiSchema schema) => { Assert.Equal(0, schema.Minimum); Assert.Null(schema.Maximum); }], 377[([Range(typeof(long), "-9223372036854775808", "9223372036854775807")] long id) => {}, (OpenApiSchema schema) => { Assert.Equal(long.MinValue, schema.Minimum); Assert.Equal(long.MaxValue, schema.Maximum); }], 378[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }], 402[([Range(typeof(DateTime), "2024-02-01", "2024-02-031")] DateTime id) => {}, (OpenApiSchema schema) => { Assert.Null(schema.Minimum); Assert.Null(schema.Maximum); }], 403[([Range(typeof(decimal), "1,99", "3,99")] decimal id) => {}, (OpenApiSchema schema) => { Assert.Equal(1.99m, schema.Minimum); Assert.Equal(3.99m, schema.Maximum); }], 404[([Range(typeof(decimal), "1,99", "3,99", ParseLimitsInInvariantCulture = true)] decimal id) => {}, (OpenApiSchema schema) => { Assert.Equal(199, schema.Minimum); Assert.Equal(399, schema.Maximum); }], 405[([Range(1000, 2000)] int id) => {}, (OpenApiSchema schema) => { Assert.Equal(1000, schema.Minimum); Assert.Equal(2000, schema.Maximum); }]
Shared\SharedTypes.cs (1)
74[Range(1, 100)]
Microsoft.Extensions.Diagnostics.Probes (2)
TcpEndpointProbesOptions.cs (2)
27[Range(1, 65535)] 36[Range(1, 10000)]
Microsoft.Extensions.Http.Diagnostics (1)
Logging\LoggingOptions.cs (1)
59[Range(1, MaxIncomingBodySize)]
Microsoft.Extensions.Http.Resilience (2)
Routing\WeightedUriEndpoint.cs (1)
33[Range(MinWeight, MaxWeight)]
Routing\WeightedUriEndpointGroup.cs (1)
23[Range(MinWeight, MaxWeight)]
Microsoft.Extensions.Telemetry (1)
Logging\LoggerEnrichmentOptions.cs (1)
67[Range(MinDefinedStackTraceLength, MaxDefinedStackTraceLength)]
RazorPagesWebSite (2)
Models\UserModel.cs (1)
13[Range(0, 99)]
Pages\Validation\PageWithValidation.cs (1)
17[Range(18, 60, ErrorMessage = "18 ≤ Age ≤ 60")]
Sample (1)
src\OpenApi\test\Microsoft.AspNetCore.OpenApi.Tests\Shared\SharedTypes.cs (1)
74[Range(1, 100)]
System.ComponentModel.Annotations (1)
System\ComponentModel\DataAnnotations\RangeAttribute.cs (1)
99/// by the <c>type</c> parameter of the <see cref="RangeAttribute(Type, string, string)"/> constructor are carried
TagHelpersWebSite (1)
Models\Employee.cs (1)
18[Range(10, 100)]
XmlFormattersWebSite (1)
Models\Employee.cs (1)
10[Range(10, 100)]
22 references to RangeAttribute
Microsoft.AspNetCore.Mvc.Core.Test (12)
ModelBinding\Metadata\ModelAttributesTest.cs (10)
40var rangeAttributes = attributes.Attributes.OfType<RangeAttribute>().ToArray(); 49rangeAttributes = attributes.PropertyAttributes.OfType<RangeAttribute>().ToArray(); 90Assert.DoesNotContain(typeof(RangeAttribute), attributes.Attributes); 94Assert.DoesNotContain(typeof(RangeAttribute), attributes.PropertyAttributes); 109Assert.Single(attributes.Attributes.OfType<RangeAttribute>()); 112Assert.Single(attributes.PropertyAttributes.OfType<RangeAttribute>()); 167Assert.IsType<RangeAttribute>(attributes.Attributes[1]); 172Assert.IsType<RangeAttribute>(attributes.PropertyAttributes[1]); 209attribute => Assert.IsType<RangeAttribute>(attribute)); 213attribute => Assert.IsType<RangeAttribute>(attribute));
ModelBinding\ParameterBinderTest.cs (1)
230var validationAttribute = new RangeAttribute(1, 100);
ModelBinding\Validation\DefaultModelValidatorProviderTest.cs (1)
116Assert.IsType<RangeAttribute>(adapter.Attribute);
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
ValidationAttributeUtil.cs (1)
35var attr = new RangeAttribute(min, max);
Microsoft.AspNetCore.Mvc.DataAnnotations (4)
RangeAttributeAdapter.cs (2)
11internal sealed class RangeAttributeAdapter : AttributeAdapterBase<RangeAttribute> 16public RangeAttributeAdapter(RangeAttribute attribute, IStringLocalizer? stringLocalizer)
ValidationAttributeAdapterProvider.cs (2)
54else if (typeof(RangeAttribute).IsAssignableFrom(type)) 56return new RangeAttributeAdapter((RangeAttribute)attribute, stringLocalizer);
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (3)
RangeAttributeAdapterTest.cs (3)
22var attribute = new RangeAttribute(typeof(decimal), "0", "100"); 52var attribute = new RangeAttribute(typeof(decimal), "0", "100"); 88var attribute = new RangeAttribute(typeof(decimal), "0", "100");
Microsoft.AspNetCore.OpenApi (1)
Extensions\JsonNodeSchemaExtensions.cs (1)
92else if (attribute is RangeAttribute rangeAttribute)
System.ComponentModel.DataAnnotations (1)
System.ComponentModel.DataAnnotations.cs (1)
26[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.DataAnnotations.RangeAttribute))]