77 instantiations of StringLengthAttribute
BasicWebSite (1)
Models\Contact.cs (1)
13[StringLength(30, MinimumLength = 5)]
FormatterWebSite (7)
Controllers\JsonFormatterController.cs (1)
107[StringLength(8, MinimumLength = 2)]
Controllers\TopLevelValidationController.cs (2)
17[BindProperty, StringLength(5)] public string OptionalStringLengthProp { get; set; } 34[StringLength(5)] string optionalStringLengthParam,
Models\DerivedModel.cs (1)
11[StringLength(10)]
Models\User.cs (1)
21[StringLength(15, MinimumLength = 3)]
Models\ValidationProviderAttributeModel.cs (2)
14[StringLength(maximumLength: 5)] 27new StringLengthAttribute(maximumLength: 5)
HtmlGenerationWebSite (2)
Models\ValidationProviderAttributeModel.cs (2)
14[StringLength(maximumLength: 6)] 27new StringLengthAttribute(maximumLength: 5)
Identity.ExternalClaims (6)
Pages\Account\LoginWith2fa.cshtml.cs (1)
38[StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Pages\Account\Manage\ChangePassword.cshtml.cs (1)
47[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Pages\Account\Manage\EnableAuthenticator.cshtml.cs (1)
49[StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Pages\Account\Manage\SetPassword.cshtml.cs (1)
38[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Pages\Account\Register.cshtml.cs (1)
50[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Pages\Account\ResetPassword.cshtml.cs (1)
35[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
IdentitySample.DefaultUI (1)
Areas\Identity\Pages\Account\Register.cshtml.cs (1)
49[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
IdentitySample.Mvc (4)
Models\AccountViewModels\RegisterViewModel.cs (1)
16[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
Models\AccountViewModels\ResetPasswordViewModel.cs (1)
15[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
Models\ManageViewModels\ChangePasswordViewModel.cs (1)
16[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
Models\ManageViewModels\SetPasswordViewModel.cs (1)
11[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
Microsoft.AspNetCore.Identity.UI (12)
Areas\Identity\Pages\V4\Account\LoginWith2fa.cshtml.cs (1)
51[StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V4\Account\Manage\ChangePassword.cshtml.cs (1)
52[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V4\Account\Manage\EnableAuthenticator.cshtml.cs (1)
66[StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V4\Account\Manage\SetPassword.cshtml.cs (1)
42[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V4\Account\Register.cshtml.cs (1)
65[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V4\Account\ResetPassword.cshtml.cs (1)
47[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V5\Account\LoginWith2fa.cshtml.cs (1)
51[StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V5\Account\Manage\ChangePassword.cshtml.cs (1)
52[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V5\Account\Manage\EnableAuthenticator.cshtml.cs (1)
66[StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V5\Account\Manage\SetPassword.cshtml.cs (1)
42[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V5\Account\Register.cshtml.cs (1)
65[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Areas\Identity\Pages\V5\Account\ResetPassword.cshtml.cs (1)
47[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
Microsoft.AspNetCore.Mvc.Core.Test (11)
ModelBinding\Metadata\ModelAttributesTest.cs (2)
305[StringLength(10)] 357[StringLength(2)]
ModelBinding\Validation\ClientValidatorCacheTest.cs (4)
109[StringLength(10)] 113private record TestRecordType([Required][StringLength(10)] string Property1); 115private record TestRecordTypeWithProperty([Required][StringLength(10)] string Property1) 118[StringLength(10)]
ModelBinding\Validation\DefaultModelValidatorProviderTest.cs (1)
240[StringLength(4)]
ModelBinding\Validation\DefaultObjectValidatorTests.cs (3)
1500[Required, StringLength(10)] 1524[StringLength(5)] 1577[StringLength(2)]
ModelBinding\Validation\ValidatorCacheTest.cs (1)
70[StringLength(10)]
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
ValidationAttributeUtil.cs (1)
18var attr = new StringLengthAttribute(maximumLength);
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (11)
DataAnnotationsMetadataProviderTest.cs (2)
1451new StringLengthAttribute(5) 1467new StringLengthAttribute(5)
DataAnnotationsModelValidatorProviderTest.cs (1)
197[StringLength(10)]
DataAnnotationsModelValidatorTest.cs (1)
480new StringLengthAttribute(length) { ErrorMessage = LocalizationKey, MinimumLength = 1},
DefaultModelClientValidatorProviderTest.cs (1)
268[StringLength(4)]
StringLengthAttributeAdapterTest.cs (5)
23var attribute = new StringLengthAttribute(8); 58var attribute = new StringLengthAttribute(8); 85var attribute = new StringLengthAttribute(10) { MinimumLength = 3 }; 113var attribute = new StringLengthAttribute(int.MaxValue); 139var attribute = new StringLengthAttribute(10) { MinimumLength = 3 };
ValidationAttributeAdapterProviderTest.cs (1)
36new StringLengthAttribute(6),
Microsoft.AspNetCore.Mvc.IntegrationTests (15)
ActionParametersIntegrationTest.cs (2)
952[Required, StringLength(3)] string requiredAndStringLengthParam, 953[Display(Name = "My Display Name"), StringLength(3)] string displayNameStringLengthParam,
BindPropertyIntegrationTest.cs (2)
304[Required, StringLength(3)] public string RequiredAndStringLengthProp { get; set; } 305[DisplayName("My Display Name"), StringLength(3)] public string DisplayNameStringLengthProp { get; set; }
CollectionModelBinderIntegrationTest.cs (1)
638[StringLength(3)]
Models\Product.cs (1)
13[StringLength(20)]
Models\Software.cs (1)
18[StringLength(10)]
ValidationIntegrationTests.cs (4)
675[StringLength(5, ErrorMessage = "Too Long.")] 763[StringLength(5, ErrorMessage = "Too Long.")] 1093[StringLength(5, ErrorMessage = "Too Long.")] 1959[StringLength(5)]
ValidationWithRecordIntegrationTests.cs (4)
560private record Order6([StringLength(5, ErrorMessage = "Too Long.")] string Name); 641private record Person7([StringLength(5, ErrorMessage = "Too Long.")] string Name); 953private record Order10([StringLength(5, ErrorMessage = "Too Long.")] string Name); 1760private record Greeting([StringLength(5)] string Message);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
DefaultHtmlGeneratorTest.cs (2)
1074[StringLength(StringLengthAttributeValue)] 1080[StringLength(StringLengthAttributeValue)]
Microsoft.AspNetCore.OpenApi.Tests (3)
Services\OpenApiSchemaService\OpenApiComponentService.ParameterSchemas.cs (3)
320[([StringLength(10)] string name) => {}, (OpenApiSchema schema) => { Assert.Equal(10, schema.MaxLength); Assert.Equal(0, schema.MinLength); }], 321[([StringLength(10, MinimumLength = 5)] string name) => {}, (OpenApiSchema schema) => { Assert.Equal(10, schema.MaxLength); Assert.Equal(5, schema.MinLength); }], 324[([Url][StringLength(10)] string url) => {}, (OpenApiSchema schema) => { Assert.Equal("string", schema.Type); Assert.Equal("uri", schema.Format); Assert.Equal(10, schema.MaxLength); }],
RazorPagesWebSite (1)
Pages\CustomModelTypeModel.cshtml.cs (1)
30[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]
23 references to StringLengthAttribute
Microsoft.AspNetCore.Mvc.Core.Test (9)
ModelBinding\Metadata\ModelAttributesTest.cs (6)
23Assert.Single(attributes.Attributes.OfType<StringLengthAttribute>()); 26Assert.Single(attributes.PropertyAttributes.OfType<StringLengthAttribute>()); 71Assert.Single(attributes.Attributes.OfType<StringLengthAttribute>()); 74Assert.Single(attributes.PropertyAttributes.OfType<StringLengthAttribute>()); 89Assert.Single(attributes.Attributes.OfType<StringLengthAttribute>()); 93Assert.Single(attributes.PropertyAttributes.OfType<StringLengthAttribute>());
ModelBinding\Validation\ClientValidatorCacheTest.cs (1)
24var attribute2 = Assert.Single(validators1.OfType<StringLengthAttributeAdapter>()).Attribute;
ModelBinding\Validation\DefaultModelValidatorProviderTest.cs (1)
139Assert.Single(validatorItems, v => ((DataAnnotationsModelValidator)v.Validator).Attribute is StringLengthAttribute);
ModelBinding\Validation\ValidatorCacheTest.cs (1)
63var stringLengthValidator = Assert.Single(validators2.Where(v => (v as DataAnnotationsModelValidator).Attribute is StringLengthAttribute));
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
ValidationAttributeUtil.cs (1)
18var attr = new StringLengthAttribute(maximumLength);
Microsoft.AspNetCore.Mvc.DataAnnotations (4)
StringLengthAttributeAdapter.cs (2)
11internal sealed class StringLengthAttributeAdapter : AttributeAdapterBase<StringLengthAttribute> 16public StringLengthAttributeAdapter(StringLengthAttribute attribute, IStringLocalizer? stringLocalizer)
ValidationAttributeAdapterProvider.cs (2)
50else if (typeof(StringLengthAttribute).IsAssignableFrom(type)) 52return new StringLengthAttributeAdapter((StringLengthAttribute)attribute, stringLocalizer);
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (5)
StringLengthAttributeAdapterTest.cs (5)
23var attribute = new StringLengthAttribute(8); 58var attribute = new StringLengthAttribute(8); 85var attribute = new StringLengthAttribute(10) { MinimumLength = 3 }; 113var attribute = new StringLengthAttribute(int.MaxValue); 139var attribute = new StringLengthAttribute(10) { MinimumLength = 3 };
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
DefaultHtmlGenerator.cs (2)
84/// <see cref="StringLengthAttribute"/> or <see cref="MaxLengthAttribute"/> attributes. 1345else if (attribute is StringLengthAttribute stringLengthAttribute && (!maxLengthValue.HasValue || maxLengthValue.Value > stringLengthAttribute.MaximumLength))
Microsoft.AspNetCore.OpenApi (1)
Extensions\JsonObjectSchemaExtensions.cs (1)
113else if (attribute is StringLengthAttribute stringLengthAttribute)
System.ComponentModel.DataAnnotations (1)
System.ComponentModel.DataAnnotations.cs (1)
38[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.DataAnnotations.StringLengthAttribute))]