1 write to ValidationMetadata
Microsoft.AspNetCore.Mvc.Core (1)
ModelBinding\Metadata\ValidationMetadataProviderContext.cs (1)
30ValidationMetadata = new ValidationMetadata();
88 references to ValidationMetadata
Microsoft.AspNetCore.Mvc.Core (13)
ModelBinding\Metadata\DefaultModelMetadata.cs (1)
145_details.ValidationMetadata = context.ValidationMetadata;
ModelBinding\Metadata\DefaultValidationMetadataProvider.cs (4)
29if (!context.ValidationMetadata.ValidatorMetadata.Contains(attribute)) 31context.ValidationMetadata.ValidatorMetadata.Add(attribute); 51context.ValidationMetadata.PropertyValidationFilter = validationFilter; 56context.ValidationMetadata.PropertyValidationFilter = validationFilter;
ModelBinding\Metadata\HasValidatorsValidationMetadataProvider.cs (5)
37if (provider.HasValidators(context.Key.ModelType, context.ValidationMetadata.ValidatorMetadata)) 39context.ValidationMetadata.HasValidators = true; 54context.ValidationMetadata.PropertyHasValidators = true; 60if (context.ValidationMetadata.HasValidators == null) 62context.ValidationMetadata.HasValidators = false;
ModelBinding\Metadata\SystemTextJsonValidationMetadataProvider.cs (1)
65context.ValidationMetadata.ValidationModelName = propertyName;
ModelBinding\SuppressChildValidationMetadataProvider.cs (2)
64context.ValidationMetadata.ValidateChildren = false; 74context.ValidationMetadata.ValidateChildren = false;
Microsoft.AspNetCore.Mvc.Core.Test (27)
ModelBinding\Metadata\DefaultModelMetadataTest.cs (1)
1675context.ValidationMetadata.HasValidators = HasValidators;
ModelBinding\Metadata\DefaultValidationMetadataProviderTest.cs (12)
24Assert.NotNull(context.ValidationMetadata.PropertyValidationFilter); 25Assert.False(context.ValidationMetadata.PropertyValidationFilter.ShouldValidateEntry( 44Assert.Null(context.ValidationMetadata.PropertyValidationFilter); 61Assert.Null(context.ValidationMetadata.PropertyValidationFilter); 80Assert.NotNull(context.ValidationMetadata.PropertyValidationFilter); 81Assert.False(context.ValidationMetadata.PropertyValidationFilter.ShouldValidateEntry( 102Assert.NotNull(context.ValidationMetadata.PropertyValidationFilter); 103Assert.False(context.ValidationMetadata.PropertyValidationFilter.ShouldValidateEntry( 123var validatorMetadata = Assert.Single(context.ValidationMetadata.ValidatorMetadata); 142var validatorMetadata = Assert.Single(context.ValidationMetadata.ValidatorMetadata); 156context.ValidationMetadata.ValidatorMetadata.Add(attribute); 162var validatorMetadata = Assert.Single(context.ValidationMetadata.ValidatorMetadata);
ModelBinding\Metadata\HasValidatorsValidationMetadataProviderTest.cs (6)
30Assert.Null(context.ValidationMetadata.HasValidators); 48Assert.Null(context.ValidationMetadata.HasValidators); 76Assert.True(context.ValidationMetadata.HasValidators); 100Assert.False(context.ValidationMetadata.HasValidators); 120context.ValidationMetadata.HasValidators = true; 126Assert.True(context.ValidationMetadata.HasValidators);
ModelBinding\Metadata\SystemTextJsonValidationMetadataProviderTest.cs (7)
25Assert.NotNull(context.ValidationMetadata.ValidationModelName); 26Assert.Equal(propertyName, context.ValidationMetadata.ValidationModelName); 43Assert.NotNull(context.ValidationMetadata.ValidationModelName); 44Assert.Equal(JsonNamingPolicy.CamelCase.ConvertName(propertyName), context.ValidationMetadata.ValidationModelName); 60Assert.Null(context.ValidationMetadata.ValidationModelName); 78Assert.NotNull(context.ValidationMetadata.ValidationModelName); 79Assert.Equal(namingPolicy.ConvertName(propertyName), context.ValidationMetadata.ValidationModelName);
ModelBinding\Validation\DefaultComplexObjectValidationStrategyTest.cs (1)
227=> context.ValidationMetadata.ValidationModelName = context.Key.Name?.ToUpperInvariant();
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
TestModelMetadataProvider.cs (1)
226action(context.ValidationMetadata);
Microsoft.AspNetCore.Mvc.DataAnnotations (3)
DataAnnotationsMetadataProvider.cs (3)
375context.ValidationMetadata.IsRequired = true; 384if (!context.ValidationMetadata.ValidatorMetadata.Contains(attribute)) 386context.ValidationMetadata.ValidatorMetadata.Add(attribute);
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (37)
DataAnnotationsMetadataProviderTest.cs (37)
1119Assert.True(context.ValidationMetadata.IsRequired); 1135context.ValidationMetadata.IsRequired = initialValue; 1141Assert.Equal(initialValue, context.ValidationMetadata.IsRequired); 1163Assert.True(context.ValidationMetadata.IsRequired); 1164var attribute = Assert.Single(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1188Assert.True(context.ValidationMetadata.IsRequired); 1189var attribute = Assert.Single(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute a); 1218Assert.Null(context.ValidationMetadata.IsRequired); 1219Assert.DoesNotContain(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1239Assert.True(context.ValidationMetadata.IsRequired); 1240Assert.Contains(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1258Assert.True(context.ValidationMetadata.IsRequired); 1259Assert.Contains(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1277Assert.Null(context.ValidationMetadata.IsRequired); 1278Assert.DoesNotContain(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1298Assert.Null(context.ValidationMetadata.IsRequired); 1299Assert.DoesNotContain(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1318Assert.True(context.ValidationMetadata.IsRequired); 1319Assert.Contains(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1337Assert.True(context.ValidationMetadata.IsRequired); 1338Assert.Contains(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1356Assert.True(context.ValidationMetadata.IsRequired); 1357Assert.Contains(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1375Assert.Null(context.ValidationMetadata.IsRequired); 1376Assert.DoesNotContain(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1396Assert.Null(context.ValidationMetadata.IsRequired); 1397Assert.DoesNotContain(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1417Assert.True(context.ValidationMetadata.IsRequired); 1418Assert.Contains(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1438Assert.Null(context.ValidationMetadata.IsRequired); 1439Assert.DoesNotContain(context.ValidationMetadata.ValidatorMetadata, m => m is RequiredAttribute); 1470Assert.Equal(expected, actual: context.ValidationMetadata.ValidatorMetadata); 1533var validatorMetadata = Assert.Single(context.ValidationMetadata.ValidatorMetadata); 1548context.ValidationMetadata.ValidatorMetadata.Add(attribute); 1554var validatorMetadata = Assert.Single(context.ValidationMetadata.ValidatorMetadata); 1569context.ValidationMetadata.ValidatorMetadata.Add(attribute); 1575var validatorMetadata = Assert.Single(context.ValidationMetadata.ValidatorMetadata);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
NewtonsoftJsonValidationMetadataProvider.cs (1)
62context.ValidationMetadata.ValidationModelName = propertyName!;
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (6)
NewtonsoftJsonValidationMetadataProviderTest.cs (6)
27Assert.NotNull(context.ValidationMetadata.ValidationModelName); 28Assert.Equal(propertyName, context.ValidationMetadata.ValidationModelName); 45Assert.NotNull(context.ValidationMetadata.ValidationModelName); 46Assert.Equal(new CamelCaseNamingStrategy().GetPropertyName(propertyName, false), context.ValidationMetadata.ValidationModelName); 64Assert.NotNull(context.ValidationMetadata.ValidationModelName); 65Assert.Equal(namingStrategy.GetPropertyName(propertyName, false), context.ValidationMetadata.ValidationModelName);