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