2 writes to ModelState
Microsoft.AspNetCore.Mvc.Abstractions (2)
ActionContext.cs (2)
24
ModelState
= new ModelStateDictionary();
75
ModelState
= modelState;
715 references to ModelState
BasicWebSite (1)
StartupWithCustomInvalidModelStateFactory.cs (1)
25
var result = new BadRequestObjectResult(context.
ModelState
);
FormatterWebSite (5)
Filters\ModelStateValidationFilterAttribute.cs (2)
13
if (!context.
ModelState
.IsValid)
15
context.Result = new BadRequestObjectResult(context.
ModelState
);
ValidateBodyParameterAttribute.cs (3)
15
if (!context.
ModelState
.IsValid)
24
var parameterBindingErrors = context.
ModelState
[bodyParameter.Name]?.Errors ??
25
context.
ModelState
[string.Empty]?.Errors;
Microsoft.AspNetCore.Mvc.Abstractions (1)
ActionContext.cs (1)
36
actionContext.
ModelState
)
Microsoft.AspNetCore.Mvc.Core (20)
ApiBehaviorOptions.cs (1)
32
/// <see cref="ActionContext.
ModelState
"/> is invalid is suppressed. <seealso cref="InvalidModelStateResponseFactory"/>.
ApplicationModels\InvalidModelStateFilterConvention.cs (1)
11
/// to <see cref="ActionModel"/> that responds to invalid <see cref="ActionContext.
ModelState
"/>
ControllerBase.cs (1)
57
public ModelStateDictionary ModelState => ControllerContext.
ModelState
;
DependencyInjection\ApiBehaviorOptionsSetup.cs (1)
32
var problemDetails = problemDetailsFactory.CreateValidationProblemDetails(context.HttpContext, context.
ModelState
);
Infrastructure\ControllerActionInvoker.cs (1)
623
var validationState = context.
ModelState
.ValidationState;
Infrastructure\ControllerActionInvokerProvider.cs (3)
71
controllerContext.
ModelState
.MaxAllowedErrors = _maxModelValidationErrors;
72
controllerContext.
ModelState
.MaxValidationDepth = _maxValidationDepth;
73
controllerContext.
ModelState
.MaxStateDepth = _maxModelBindingRecursionDepth;
Infrastructure\ModelStateInvalidFilter.cs (2)
13
/// A <see cref="IActionFilter"/> that responds to invalid <see cref="ActionContext.
ModelState
"/>. This filter is
76
if (context.Result == null && !context.
ModelState
.IsValid)
ModelBinding\CompositeValueProvider.cs (1)
90
actionContext.
ModelState
.TryAddModelException(key: string.Empty, exception);
ModelBinding\DefaultModelBindingContext.cs (1)
228
ModelState = actionContext.
ModelState
,
ModelBinding\ModelBindingHelper.cs (1)
239
var modelState = actionContext.
ModelState
;
ModelBinding\ParameterBinder.cs (1)
187
actionContext.
ModelState
.TryAddModelError(modelName, message);
ModelBinding\UnsupportedContentTypeFilter.cs (2)
13
/// <see cref="ActionContext.
ModelState
"/> and short-circuits the pipeline
37
var modelState = context.
ModelState
;
ModelBinding\Validation\ValidationVisitor.cs (1)
48
ModelState = actionContext.
ModelState
;
Routing\ControllerRequestDelegateFactory.cs (3)
88
controllerContext.
ModelState
.MaxAllowedErrors = _maxModelValidationErrors;
89
controllerContext.
ModelState
.MaxValidationDepth = _maxValidationDepth;
90
controllerContext.
ModelState
.MaxStateDepth = _maxModelBindingRecursionDepth;
Microsoft.AspNetCore.Mvc.Core.Test (88)
ControllerBaseTest.cs (1)
2342
context.
ModelState
.AddModelError("key1", "error1");
Controllers\ControllerBinderDelegateProviderTest.cs (7)
416
Assert.False(controllerContext.
ModelState
.IsValid);
419
controllerContext.
ModelState
["memberName"].Errors.Single().ErrorMessage);
512
Assert.False(controllerContext.
ModelState
.IsValid);
515
controllerContext.
ModelState
["memberName"].Errors.Single().ErrorMessage);
562
Assert.True(controllerContext.
ModelState
.IsValid);
1177
var modelState = controllerContext.
ModelState
;
1229
var modelState = controllerContext.
ModelState
;
Filters\MiddlewareFilterTest.cs (1)
434
controllerContext.
ModelState
.MaxAllowedErrors = maxAllowedErrorsInModelState;
Infrastructure\ControllerActionInvokerTest.cs (1)
1415
controllerContext.
ModelState
.MaxAllowedErrors = 200;
Infrastructure\ModelStateInvalidFilterTest.cs (1)
63
context.
ModelState
.AddModelError("some-key", "some-error");
ModelBinding\Binders\ArrayModelBinderTest.cs (1)
238
ModelState = actionContext.
ModelState
,
ModelBinding\Binders\CollectionModelBinderTest.cs (1)
538
ModelState = actionContext.
ModelState
,
ModelBinding\Binders\DictionaryModelBinderTest.cs (1)
629
ModelState = actionContext.
ModelState
,
ModelBinding\CompositeValueProviderTest.cs (1)
59
var modelState = actionContext.
ModelState
;
ModelBinding\ModelBindingHelperTest.cs (1)
70
var modelState = actionContext.
ModelState
;
ModelBinding\ParameterBinderTest.cs (26)
78
Assert.False(actionContext.
ModelState
.IsValid);
79
Assert.Equal("myParam", actionContext.
ModelState
.Single().Key);
82
actionContext.
ModelState
.Single().Value.Errors.Single().ErrorMessage);
116
Assert.False(actionContext.
ModelState
.IsValid);
117
Assert.Equal("myParam", actionContext.
ModelState
.Single().Key);
120
actionContext.
ModelState
.Single().Value.Errors.Single().ErrorMessage);
216
Assert.False(actionContext.
ModelState
.IsValid);
217
var modelState = Assert.Single(actionContext.
ModelState
);
254
Assert.False(actionContext.
ModelState
.IsValid);
255
Assert.Equal("myParam", actionContext.
ModelState
.Single().Key);
258
actionContext.
ModelState
.Single().Value.Errors.Single().ErrorMessage);
276
context.
ModelState
.AddModelError(prefix, "Test validation message");
295
Assert.False(actionContext.
ModelState
.IsValid);
296
Assert.Equal("myParam", actionContext.
ModelState
.Single().Key);
299
actionContext.
ModelState
.Single().Value.Errors.Single().ErrorMessage);
347
Assert.False(actionContext.
ModelState
.IsValid);
349
actionContext.
ModelState
,
402
Assert.False(actionContext.
ModelState
.IsValid);
404
actionContext.
ModelState
,
457
Assert.False(actionContext.
ModelState
.IsValid);
459
actionContext.
ModelState
,
511
Assert.False(actionContext.
ModelState
.IsValid);
513
actionContext.
ModelState
,
534
var modelState = actionContext.
ModelState
;
593
var modelState = actionContext.
ModelState
;
665
var modelState = actionContext.
ModelState
;
ModelBinding\UnsupportedContentTypeFilterTest.cs (3)
31
context.
ModelState
.AddModelError(
61
context.
ModelState
.AddModelError("person.body", "Some error");
114
context.
ModelState
.AddModelError(
ModelBinding\Validation\DefaultObjectValidatorTests.cs (43)
26
var modelState = actionContext.
ModelState
;
52
var modelState = actionContext.
ModelState
;
79
var modelState = actionContext.
ModelState
;
108
var modelState = actionContext.
ModelState
;
136
var modelState = actionContext.
ModelState
;
157
var modelState = actionContext.
ModelState
;
189
var modelState = actionContext.
ModelState
;
221
var modelState = actionContext.
ModelState
;
253
var modelState = actionContext.
ModelState
;
295
var modelState = actionContext.
ModelState
;
327
var modelState = actionContext.
ModelState
;
359
var modelState = actionContext.
ModelState
;
400
var modelState = actionContext.
ModelState
;
434
var modelState = actionContext.
ModelState
;
471
var modelState = actionContext.
ModelState
;
516
var modelState = actionContext.
ModelState
;
589
var modelState = actionContext.
ModelState
;
618
var modelState = actionContext.
ModelState
;
646
var modelState = actionContext.
ModelState
;
682
var modelState = actionContext.
ModelState
;
717
var modelState = actionContext.
ModelState
;
754
var modelState = actionContext.
ModelState
;
787
var modelState = actionContext.
ModelState
;
830
var modelState = actionContext.
ModelState
;
905
var modelState = actionContext.
ModelState
;
946
var modelState = actionContext.
ModelState
;
980
var modelState = actionContext.
ModelState
;
1027
var modelState = actionContext.
ModelState
;
1087
var modelState = actionContext.
ModelState
;
1108
var modelState = actionContext.
ModelState
;
1128
var modelState = actionContext.
ModelState
;
1161
var modelState = actionContext.
ModelState
;
1202
var modelState = actionContext.
ModelState
;
1225
var modelState = actionContext.
ModelState
;
1300
Assert.True(actionContext.
ModelState
.IsValid);
1310
actionContext.
ModelState
.MaxAllowedErrors = 2;
1329
Assert.False(actionContext.
ModelState
.IsValid);
1354
var modelState = actionContext.
ModelState
;
1370
actionContext.
ModelState
.SetModelValue("Property1", new ValueProviderResult("value1"));
1371
actionContext.
ModelState
.SetModelValue("Property2", new ValueProviderResult("value2"));
1377
var modelState = actionContext.
ModelState
;
1399
var modelState = actionContext.
ModelState
;
1429
var modelState = actionContext.
ModelState
;
Microsoft.AspNetCore.Mvc.IntegrationTests (496)
ActionParametersIntegrationTest.cs (20)
49
var modelState = testContext.
ModelState
;
95
var modelState = testContext.
ModelState
;
142
var modelState = testContext.
ModelState
;
190
var modelState = testContext.
ModelState
;
230
var modelState = testContext.
ModelState
;
274
var modelState = testContext.
ModelState
;
321
var modelState = testContext.
ModelState
;
366
var modelState = testContext.
ModelState
;
401
var modelState = testContext.
ModelState
;
434
var modelState = testContext.
ModelState
;
468
var modelState = testContext.
ModelState
;
554
var modelState = testContext.
ModelState
;
587
var modelState = testContext.
ModelState
;
605
var modelState = testContext.
ModelState
;
647
var modelState = testContext.
ModelState
;
680
var modelState = testContext.
ModelState
;
725
var modelState = testContext.
ModelState
;
778
var modelState = testContext.
ModelState
;
820
var modelState = testContext.
ModelState
;
865
var modelState = testContext.
ModelState
;
ArrayModelBinderIntegrationTest.cs (10)
29
var modelState = testContext.
ModelState
;
73
var modelState = testContext.
ModelState
;
113
var modelState = testContext.
ModelState
;
153
var modelState = testContext.
ModelState
;
188
var modelState = testContext.
ModelState
;
233
var modelState = testContext.
ModelState
;
274
var modelState = testContext.
ModelState
;
315
var modelState = testContext.
ModelState
;
352
var modelState = testContext.
ModelState
;
393
var modelState = testContext.
ModelState
;
BinderTypeBasedModelBinderIntegrationTest.cs (7)
32
var modelState = testContext.
ModelState
;
66
var modelState = testContext.
ModelState
;
103
var modelState = testContext.
ModelState
;
166
var modelState = testContext.
ModelState
;
217
var modelState = testContext.
ModelState
;
254
var modelState = testContext.
ModelState
;
293
var modelState = testContext.
ModelState
;
BindingSourceMetadataProviderIntegrationTest.cs (2)
42
var modelState = testContext.
ModelState
;
96
var modelState = testContext.
ModelState
;
BindPropertyIntegrationTest.cs (5)
133
Assert.True(testContext.
ModelState
.IsValid);
173
Assert.Equal(isValid, testContext.
ModelState
.IsValid);
241
Assert.Equal(isValid, pageContext.
ModelState
.IsValid);
292
Assert.Equal(isValid, testContext.
ModelState
.IsValid);
295
var message = testContext.
ModelState
[propertyName].Errors.Single().ErrorMessage;
BodyValidationIntegrationTests.cs (19)
40
var modelState = testContext.
ModelState
;
80
var modelState = testContext.
ModelState
;
115
var modelState = testContext.
ModelState
;
165
var modelState = testContext.
ModelState
;
206
var modelState = testContext.
ModelState
;
246
var modelState = testContext.
ModelState
;
282
var modelState = testContext.
ModelState
;
327
var modelState = testContext.
ModelState
;
377
var modelState = testContext.
ModelState
;
419
var modelState = testContext.
ModelState
;
467
var modelState = testContext.
ModelState
;
531
var modelState = testContext.
ModelState
;
573
var modelState = testContext.
ModelState
;
626
var modelState = testContext.
ModelState
;
671
var modelState = testContext.
ModelState
;
721
var modelState = testContext.
ModelState
;
779
var modelState = testContext.
ModelState
;
826
var modelState = testContext.
ModelState
;
872
var modelState = testContext.
ModelState
;
ByteArrayModelBinderIntegrationTest.cs (3)
42
var modelState = testContext.
ModelState
;
87
var modelState = testContext.
ModelState
;
126
var modelState = testContext.
ModelState
;
CancellationTokenModelBinderIntegrationTest.cs (3)
33
var modelState = testContext.
ModelState
;
69
var modelState = testContext.
ModelState
;
108
var modelState = testContext.
ModelState
;
CollectionModelBinderIntegrationTest.cs (23)
35
var modelState = testContext.
ModelState
;
83
var modelState = testContext.
ModelState
;
119
var modelState = testContext.
ModelState
;
151
var modelState = testContext.
ModelState
;
191
var modelState = testContext.
ModelState
;
231
var modelState = testContext.
ModelState
;
264
var modelState = testContext.
ModelState
;
302
var modelState = testContext.
ModelState
;
361
var modelState = testContext.
ModelState
;
412
var modelState = testContext.
ModelState
;
464
var modelState = testContext.
ModelState
;
507
var modelState = testContext.
ModelState
;
558
var modelState = testContext.
ModelState
;
608
var modelState = testContext.
ModelState
;
665
var modelState = testContext.
ModelState
;
705
var modelState = testContext.
ModelState
;
948
var modelState = testContext.
ModelState
;
990
var modelState = testContext.
ModelState
;
1019
var modelState = testContext.
ModelState
;
1076
var modelState = testContext.
ModelState
;
1114
var modelState = testContext.
ModelState
;
1142
var modelState = testContext.
ModelState
;
1191
var modelState = testContext.
ModelState
;
ComplexRecordIntegrationTest.cs (77)
48
var modelState = testContext.
ModelState
;
98
var modelState = testContext.
ModelState
;
150
var modelState = testContext.
ModelState
;
204
var modelState = testContext.
ModelState
;
253
var modelState = testContext.
ModelState
;
302
var modelState = testContext.
ModelState
;
350
var modelState = testContext.
ModelState
;
402
var modelState = testContext.
ModelState
;
454
var modelState = testContext.
ModelState
;
507
var modelState = testContext.
ModelState
;
560
var modelState = testContext.
ModelState
;
614
var modelState = testContext.
ModelState
;
664
var modelState = testContext.
ModelState
;
721
var modelState = testContext.
ModelState
;
775
var modelState = testContext.
ModelState
;
830
var modelState = testContext.
ModelState
;
885
var modelState = testContext.
ModelState
;
932
var modelState = testContext.
ModelState
;
978
var modelState = testContext.
ModelState
;
1033
var modelState = testContext.
ModelState
;
1088
var modelState = testContext.
ModelState
;
1135
var modelState = testContext.
ModelState
;
1181
var modelState = testContext.
ModelState
;
1236
var modelState = testContext.
ModelState
;
1291
var modelState = testContext.
ModelState
;
1338
var modelState = testContext.
ModelState
;
1397
var modelState = testContext.
ModelState
;
1504
var modelState = testContext.
ModelState
;
1611
var modelState = testContext.
ModelState
;
1715
var modelState = testContext.
ModelState
;
1770
var modelState = testContext.
ModelState
;
1834
var modelState = testContext.
ModelState
;
1920
var modelState = testContext.
ModelState
;
1966
var modelState = testContext.
ModelState
;
2022
var modelState = testContext.
ModelState
;
2074
var modelState = testContext.
ModelState
;
2128
var modelState = testContext.
ModelState
;
2186
var modelState = testContext.
ModelState
;
2242
var modelState = testContext.
ModelState
;
2294
var modelState = testContext.
ModelState
;
2342
var modelState = testContext.
ModelState
;
2390
var modelState = testContext.
ModelState
;
2442
var modelState = testContext.
ModelState
;
2489
var modelState = testContext.
ModelState
;
2539
var modelState = testContext.
ModelState
;
2593
var modelState = testContext.
ModelState
;
2652
var modelState = testContext.
ModelState
;
2701
var modelState = testContext.
ModelState
;
2757
var modelState = testContext.
ModelState
;
2811
var modelState = testContext.
ModelState
;
2915
var modelState = testContext.
ModelState
;
2984
var modelState = testContext.
ModelState
;
3056
var modelState = testContext.
ModelState
;
3120
var modelState = testContext.
ModelState
;
3172
var modelState = testContext.
ModelState
;
3247
var modelState = testContext.
ModelState
;
3318
var modelState = testContext.
ModelState
;
3347
var modelState = testContext.
ModelState
;
3388
var modelState = testContext.
ModelState
;
3422
var modelState = testContext.
ModelState
;
3454
var modelState = testContext.
ModelState
;
3496
var modelState = testContext.
ModelState
;
3539
var modelState = testContext.
ModelState
;
3582
var modelState = testContext.
ModelState
;
3633
var modelState = testContext.
ModelState
;
3679
var modelState = testContext.
ModelState
;
3731
var modelState = testContext.
ModelState
;
3774
var modelState = testContext.
ModelState
;
3819
var modelState = testContext.
ModelState
;
3862
var modelState = testContext.
ModelState
;
3906
var modelState = testContext.
ModelState
;
3951
var modelState = testContext.
ModelState
;
3995
var modelState = testContext.
ModelState
;
4036
var modelState = testContext.
ModelState
;
4079
var modelState = testContext.
ModelState
;
4124
var modelState = testContext.
ModelState
;
4169
var modelState = testContext.
ModelState
;
ComplexTypeIntegrationTestBase.cs (61)
85
var modelState = testContext.
ModelState
;
135
var modelState = testContext.
ModelState
;
187
var modelState = testContext.
ModelState
;
236
var modelState = testContext.
ModelState
;
285
var modelState = testContext.
ModelState
;
343
var modelState = testContext.
ModelState
;
395
var modelState = testContext.
ModelState
;
447
var modelState = testContext.
ModelState
;
510
var modelState = testContext.
ModelState
;
563
var modelState = testContext.
ModelState
;
617
var modelState = testContext.
ModelState
;
667
var modelState = testContext.
ModelState
;
724
var modelState = testContext.
ModelState
;
783
var modelState = testContext.
ModelState
;
838
var modelState = testContext.
ModelState
;
893
var modelState = testContext.
ModelState
;
940
var modelState = testContext.
ModelState
;
991
var modelState = testContext.
ModelState
;
1046
var modelState = testContext.
ModelState
;
1101
var modelState = testContext.
ModelState
;
1148
var modelState = testContext.
ModelState
;
1199
var modelState = testContext.
ModelState
;
1254
var modelState = testContext.
ModelState
;
1309
var modelState = testContext.
ModelState
;
1356
var modelState = testContext.
ModelState
;
1433
var modelState = testContext.
ModelState
;
1540
var modelState = testContext.
ModelState
;
1647
var modelState = testContext.
ModelState
;
1756
var modelState = testContext.
ModelState
;
1811
var modelState = testContext.
ModelState
;
1866
var modelState = testContext.
ModelState
;
1915
var modelState = testContext.
ModelState
;
1974
var modelState = testContext.
ModelState
;
2067
var modelState = testContext.
ModelState
;
2120
var modelState = testContext.
ModelState
;
2175
var modelState = testContext.
ModelState
;
2236
var modelState = testContext.
ModelState
;
2290
var modelState = testContext.
ModelState
;
2348
var modelState = testContext.
ModelState
;
2408
var modelState = testContext.
ModelState
;
2460
var modelState = testContext.
ModelState
;
2508
var modelState = testContext.
ModelState
;
2560
var modelState = testContext.
ModelState
;
2612
var modelState = testContext.
ModelState
;
2659
var modelState = testContext.
ModelState
;
2712
var modelState = testContext.
ModelState
;
2766
var modelState = testContext.
ModelState
;
2831
var modelState = testContext.
ModelState
;
2880
var modelState = testContext.
ModelState
;
2948
var modelState = testContext.
ModelState
;
3002
var modelState = testContext.
ModelState
;
3119
var modelState = testContext.
ModelState
;
3192
var modelState = testContext.
ModelState
;
3271
var modelState = testContext.
ModelState
;
3342
var modelState = testContext.
ModelState
;
3394
var modelState = testContext.
ModelState
;
3476
var modelState = testContext.
ModelState
;
3553
var modelState = testContext.
ModelState
;
3592
var modelState = testContext.
ModelState
;
3639
var modelState = testContext.
ModelState
;
3691
var modelState = testContext.
ModelState
;
DictionaryModelBinderIntegrationTest.cs (31)
33
var modelState = testContext.
ModelState
;
73
var modelState = testContext.
ModelState
;
111
var modelState = testContext.
ModelState
;
164
var modelState = testContext.
ModelState
;
201
var modelState = testContext.
ModelState
;
340
var modelState = testContext.
ModelState
;
377
var modelState = testContext.
ModelState
;
413
var modelState = testContext.
ModelState
;
449
var modelState = testContext.
ModelState
;
518
var modelState = testContext.
ModelState
;
550
var modelState = testContext.
ModelState
;
588
var modelState = testContext.
ModelState
;
623
var modelState = testContext.
ModelState
;
658
var modelState = testContext.
ModelState
;
716
var modelState = testContext.
ModelState
;
755
var modelState = testContext.
ModelState
;
795
var modelState = testContext.
ModelState
;
835
var modelState = testContext.
ModelState
;
871
var modelState = testContext.
ModelState
;
919
var modelState = testContext.
ModelState
;
947
var modelState = testContext.
ModelState
;
981
var modelState = testContext.
ModelState
;
1020
var modelState = testContext.
ModelState
;
1059
var modelState = testContext.
ModelState
;
1176
var modelState = testContext.
ModelState
;
1219
var modelState = testContext.
ModelState
;
1247
var modelState = testContext.
ModelState
;
1301
var modelState = testContext.
ModelState
;
1376
var modelState = testContext.
ModelState
;
1412
var modelState = testContext.
ModelState
;
1454
var modelState = testContext.
ModelState
;
FormCollectionModelBindingIntegrationTest.cs (3)
46
var modelState = testContext.
ModelState
;
96
var modelState = testContext.
ModelState
;
136
var modelState = testContext.
ModelState
;
FormFileModelBindingIntegrationTest.cs (22)
46
var modelState = testContext.
ModelState
;
93
var modelState = testContext.
ModelState
;
144
var modelState = testContext.
ModelState
;
203
var modelState = testContext.
ModelState
;
290
var modelState = testContext.
ModelState
;
355
var modelState = testContext.
ModelState
;
421
var modelState = testContext.
ModelState
;
486
var modelState = testContext.
ModelState
;
531
var modelState = testContext.
ModelState
;
575
var modelState = testContext.
ModelState
;
629
var modelState = testContext.
ModelState
;
675
var modelState = testContext.
ModelState
;
715
var modelState = testContext.
ModelState
;
775
var modelState = testContext.
ModelState
;
840
var modelState = testContext.
ModelState
;
900
var modelState = testContext.
ModelState
;
940
var modelState = testContext.
ModelState
;
1002
var modelState = testContext.
ModelState
;
1057
var modelState = testContext.
ModelState
;
1108
var modelState = testContext.
ModelState
;
1153
var modelState = testContext.
ModelState
;
1217
var modelState = testContext.
ModelState
;
GenericModelBinderIntegrationTest.cs (14)
37
var modelState = testContext.
ModelState
;
75
var modelState = testContext.
ModelState
;
114
var modelState = testContext.
ModelState
;
196
var modelState = testContext.
ModelState
;
239
var modelState = testContext.
ModelState
;
274
var modelState = testContext.
ModelState
;
319
var modelState = testContext.
ModelState
;
364
var modelState = testContext.
ModelState
;
399
var modelState = testContext.
ModelState
;
443
var modelState = testContext.
ModelState
;
487
var modelState = testContext.
ModelState
;
523
var modelState = testContext.
ModelState
;
571
var modelState = testContext.
ModelState
;
619
var modelState = testContext.
ModelState
;
HeaderModelBinderIntegrationTest.cs (7)
44
var modelState = testContext.
ModelState
;
83
var modelState = testContext.
ModelState
;
125
var modelState = testContext.
ModelState
;
171
var modelState = testContext.
ModelState
;
218
var modelState = testContext.
ModelState
;
281
var modelState = testContext.
ModelState
;
332
var modelState = testContext.
ModelState
;
JQueryFormatModelBindingIntegrationTest.cs (2)
35
var modelState = testContext.
ModelState
;
73
var modelState = testContext.
ModelState
;
KeyValuePairModelBinderIntegrationTest.cs (13)
29
var modelState = testContext.
ModelState
;
67
var modelState = testContext.
ModelState
;
111
var modelState = testContext.
ModelState
;
154
var modelState = testContext.
ModelState
;
198
var modelState = testContext.
ModelState
;
247
var modelState = testContext.
ModelState
;
287
var modelState = testContext.
ModelState
;
327
var modelState = testContext.
ModelState
;
365
var modelState = testContext.
ModelState
;
410
var modelState = testContext.
ModelState
;
451
var modelState = testContext.
ModelState
;
492
var modelState = testContext.
ModelState
;
528
var modelState = testContext.
ModelState
;
ModelPrefixSelectionIntegrationTest.cs (5)
44
var modelState = testContext.
ModelState
;
93
var modelState = testContext.
ModelState
;
132
var modelState = testContext.
ModelState
;
181
var modelState = testContext.
ModelState
;
227
var modelState = testContext.
ModelState
;
NullableReferenceTypeIntegrationTest.cs (4)
33
var modelState = testContext.
ModelState
;
81
var modelState = testContext.
ModelState
;
120
var modelState = testContext.
ModelState
;
172
var modelState = testContext.
ModelState
;
ServicesModelBinderIntegrationTest.cs (10)
32
var modelState = testContext.
ModelState
;
69
var modelState = testContext.
ModelState
;
105
var modelState = testContext.
ModelState
;
141
var modelState = testContext.
ModelState
;
214
var modelState = testContext.
ModelState
;
247
var modelState = testContext.
ModelState
;
283
var modelState = testContext.
ModelState
;
316
var modelState = testContext.
ModelState
;
355
var modelState = testContext.
ModelState
;
393
var modelState = testContext.
ModelState
;
SimpleTypeModelBinderIntegrationTest.cs (17)
39
var modelState = testContext.
ModelState
;
83
var modelState = testContext.
ModelState
;
128
var modelState = testContext.
ModelState
;
172
var modelState = testContext.
ModelState
;
205
var modelState = testContext.
ModelState
;
249
var modelState = testContext.
ModelState
;
298
var modelState = testContext.
ModelState
;
334
var modelState = testContext.
ModelState
;
378
var modelState = testContext.
ModelState
;
431
var modelState = testContext.
ModelState
;
487
var modelState = testContext.
ModelState
;
534
var modelState = testContext.
ModelState
;
584
var modelState = testContext.
ModelState
;
622
var modelState = testContext.
ModelState
;
676
var modelState = testContext.
ModelState
;
722
var modelState = testContext.
ModelState
;
766
var modelState = testContext.
ModelState
;
TryUpdateModelIntegrationTest.cs (29)
29
var modelState = testContext.
ModelState
;
69
var modelState = testContext.
ModelState
;
114
var modelState = testContext.
ModelState
;
168
var modelState = testContext.
ModelState
;
218
var modelState = testContext.
ModelState
;
254
var modelState = testContext.
ModelState
;
305
var modelState = testContext.
ModelState
;
361
var modelState = testContext.
ModelState
;
390
var modelState = testContext.
ModelState
;
424
var modelState = testContext.
ModelState
;
460
var modelState = testContext.
ModelState
;
513
var modelState = testContext.
ModelState
;
554
var modelState = testContext.
ModelState
;
601
var modelState = testContext.
ModelState
;
636
var modelState = testContext.
ModelState
;
676
var modelState = testContext.
ModelState
;
714
var modelState = testContext.
ModelState
;
768
var modelState = testContext.
ModelState
;
813
var modelState = testContext.
ModelState
;
849
var modelState = testContext.
ModelState
;
890
var modelState = testContext.
ModelState
;
941
var modelState = testContext.
ModelState
;
977
var modelState = testContext.
ModelState
;
1025
var modelState = testContext.
ModelState
;
1052
var modelState = testContext.
ModelState
;
1106
var modelState = testContext.
ModelState
;
1151
var modelState = testContext.
ModelState
;
1178
var modelState = testContext.
ModelState
;
1224
var modelState = testContext.
ModelState
;
TryValidateModelIntegrationTest.cs (5)
20
var modelState = testContext.
ModelState
;
50
var modelState = testContext.
ModelState
;
81
var modelState = testContext.
ModelState
;
137
var modelState = testContext.
ModelState
;
158
var modelState = testContext.
ModelState
;
ValidationIntegrationTests.cs (52)
103
var modelState = testContext.
ModelState
;
145
var modelState = testContext.
ModelState
;
179
var modelState = testContext.
ModelState
;
216
var modelState = testContext.
ModelState
;
267
var modelState = testContext.
ModelState
;
305
var modelState = testContext.
ModelState
;
358
var modelState = testContext.
ModelState
;
397
var modelState = testContext.
ModelState
;
450
var modelState = testContext.
ModelState
;
489
var modelState = testContext.
ModelState
;
537
var modelState = testContext.
ModelState
;
575
var modelState = testContext.
ModelState
;
636
var modelState = testContext.
ModelState
;
660
var modelState = testContext.
ModelState
;
695
var modelState = testContext.
ModelState
;
732
var modelState = testContext.
ModelState
;
783
var modelState = testContext.
ModelState
;
820
var modelState = testContext.
ModelState
;
860
var modelState = testContext.
ModelState
;
918
var modelState = testContext.
ModelState
;
955
var modelState = testContext.
ModelState
;
1025
var modelState = testContext.
ModelState
;
1062
var modelState = testContext.
ModelState
;
1113
var modelState = testContext.
ModelState
;
1150
var modelState = testContext.
ModelState
;
1190
var modelState = testContext.
ModelState
;
1230
var modelState = testContext.
ModelState
;
1270
var modelState = testContext.
ModelState
;
1361
var modelState = testContext.
ModelState
;
1410
var modelState = testContext.
ModelState
;
1449
var modelState = testContext.
ModelState
;
1479
var modelState = testContext.
ModelState
;
1512
var modelState = testContext.
ModelState
;
1579
var modelState = testContext.
ModelState
;
1619
var modelState = testContext.
ModelState
;
1669
var modelState = testContext.
ModelState
;
1746
var modelState = testContext.
ModelState
;
1797
var modelState = testContext.
ModelState
;
1841
var modelState = testContext.
ModelState
;
1886
var modelState = testContext.
ModelState
;
1933
var modelState = testContext.
ModelState
;
1990
var modelState = testContext.
ModelState
;
2039
var modelState = testContext.
ModelState
;
2091
var modelState = testContext.
ModelState
;
2161
var modelState = testContext.
ModelState
;
2223
var modelState = testContext.
ModelState
;
2270
var modelState = testContext.
ModelState
;
2327
var modelState = testContext.
ModelState
;
2381
var modelState = testContext.
ModelState
;
2433
var modelState = testContext.
ModelState
;
2485
var modelState = testContext.
ModelState
;
2535
var modelState = testContext.
ModelState
;
ValidationWithRecordIntegrationTests.cs (52)
95
var modelState = testContext.
ModelState
;
137
var modelState = testContext.
ModelState
;
167
var modelState = testContext.
ModelState
;
204
var modelState = testContext.
ModelState
;
248
var modelState = testContext.
ModelState
;
286
var modelState = testContext.
ModelState
;
330
var modelState = testContext.
ModelState
;
369
var modelState = testContext.
ModelState
;
415
var modelState = testContext.
ModelState
;
454
var modelState = testContext.
ModelState
;
496
var modelState = testContext.
ModelState
;
534
var modelState = testContext.
ModelState
;
578
var modelState = testContext.
ModelState
;
615
var modelState = testContext.
ModelState
;
659
var modelState = testContext.
ModelState
;
696
var modelState = testContext.
ModelState
;
736
var modelState = testContext.
ModelState
;
787
var modelState = testContext.
ModelState
;
824
var modelState = testContext.
ModelState
;
887
var modelState = testContext.
ModelState
;
924
var modelState = testContext.
ModelState
;
971
var modelState = testContext.
ModelState
;
1008
var modelState = testContext.
ModelState
;
1048
var modelState = testContext.
ModelState
;
1082
var modelState = testContext.
ModelState
;
1122
var modelState = testContext.
ModelState
;
1205
var modelState = testContext.
ModelState
;
1254
var modelState = testContext.
ModelState
;
1293
var modelState = testContext.
ModelState
;
1323
var modelState = testContext.
ModelState
;
1387
var modelState = testContext.
ModelState
;
1427
var modelState = testContext.
ModelState
;
1475
var modelState = testContext.
ModelState
;
1549
var modelState = testContext.
ModelState
;
1600
var modelState = testContext.
ModelState
;
1644
var modelState = testContext.
ModelState
;
1689
var modelState = testContext.
ModelState
;
1736
var modelState = testContext.
ModelState
;
1785
var modelState = testContext.
ModelState
;
1830
var modelState = testContext.
ModelState
;
1882
var modelState = testContext.
ModelState
;
1952
var modelState = testContext.
ModelState
;
2014
var modelState = testContext.
ModelState
;
2061
var modelState = testContext.
ModelState
;
2118
var modelState = testContext.
ModelState
;
2169
var modelState = testContext.
ModelState
;
2221
var modelState = testContext.
ModelState
;
2271
var modelState = testContext.
ModelState
;
2323
var modelState = testContext.
ModelState
;
2362
var modelState = testContext.
ModelState
;
2403
var modelState = testContext.
ModelState
;
2438
var modelState = testContext.
ModelState
;
Microsoft.AspNetCore.Mvc.Razor (1)
RazorPagePropertyActivator.cs (1)
64
return _rootFactory(_metadataProvider, context.
ModelState
);
Microsoft.AspNetCore.Mvc.RazorPages (6)
Infrastructure\PageActionInvokerProvider.cs (1)
85
ViewData = cacheEntry.ViewDataFactory(_modelMetadataProvider, actionContext.
ModelState
),
Infrastructure\PageRequestDelegateFactory.cs (1)
99
pageContext.ViewData = cacheEntry.ViewDataFactory(_modelMetadataProvider, pageContext.
ModelState
);
PageBase.cs (1)
62
public ModelStateDictionary ModelState => PageContext?.
ModelState
!;
PageLoggerExtensions.cs (2)
92
var validationState = context.
ModelState
.ValidationState;
115
var validationState = context.
ModelState
.ValidationState;
PageModel.cs (1)
81
public ModelStateDictionary ModelState => PageContext.
ModelState
;
Microsoft.AspNetCore.Mvc.RazorPages.Test (7)
Infrastructure\PageActionInvokerProviderTest.cs (2)
142
Assert.Same(context.ActionContext.
ModelState
, pageContext.
ModelState
);
Infrastructure\PageActionInvokerTest.cs (1)
1514
pageContext.ViewData = viewDataFactory(new EmptyModelMetadataProvider(), pageContext.
ModelState
);
Infrastructure\PageBinderFactoryTest.cs (3)
565
var modelState = page.PageContext.
ModelState
;
695
var modelState = page.PageContext.
ModelState
;
746
var modelState = pageContext.
ModelState
;
PageLoggerExtensionsTest.cs (1)
138
context.
ModelState
.AddModelError("foo", "bar");
Microsoft.AspNetCore.Mvc.TagHelpers.Test (4)
LabelTagHelperTest.cs (1)
295
var viewData = new ViewDataDictionary<NestedModel>(metadataProvider, viewContext.
ModelState
);
ValidationSummaryTagHelperTest.cs (3)
246
var modelState = viewContext.
ModelState
;
316
var modelState = viewContext.
ModelState
;
632
viewContext.
ModelState
.AddModelError(key: nameof(FormMetadata.ID), errorMessage: expectedError);
Microsoft.AspNetCore.Mvc.ViewFeatures (65)
Controller.cs (1)
46
_viewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), ControllerContext.
ModelState
);
IHtmlGenerator.cs (1)
511
/// <see cref="ActionContext.
ModelState
"/> contains an error for the <paramref name="expression"/>.
Rendering\HtmlHelperInputExtensions.cs (24)
18
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
42
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
72
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
104
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
129
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
152
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
180
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
276
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
308
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
347
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
385
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
416
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
439
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
467
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
500
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
535
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
562
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
594
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
628
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
653
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
684
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
712
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
746
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
773
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
Rendering\HtmlHelperSelectExtensions.cs (11)
19
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
50
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
90
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
124
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
163
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
201
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
236
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
280
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
319
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
349
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
383
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
Rendering\HtmlHelperValueExtensions.cs (4)
16
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
37
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
62
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
82
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
Rendering\IHtmlHelper.cs (10)
172
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
176
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
256
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
402
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
447
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
521
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
525
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
613
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
638
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
718
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
Rendering\IHtmlHelperOfT.cs (10)
26
/// the <see cref="ActionContext.
ModelState
"/> entry with full name.
29
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
118
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
191
/// the <see cref="ActionContext.
ModelState
"/> entry with full name or
240
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
305
/// the <see cref="ActionContext.
ModelState
"/> entry with full name.
308
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
340
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
367
/// the <see cref="ActionContext.
ModelState
"/> entry with full name,
425
/// the <see cref="ActionContext.
ModelState
"/> entry with full name, or
Rendering\ViewContext.cs (1)
34
ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(),
ModelState
);
ViewComponentResultExecutor.cs (1)
77
viewData = new ViewDataDictionary(_modelMetadataProvider, context.
ModelState
);
ViewDataDictionaryControllerPropertyActivator.cs (1)
92
context.
ModelState
);
ViewExecutor.cs (1)
149
viewData = new ViewDataDictionary(ModelMetadataProvider, actionContext.
ModelState
);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (21)
ControllerUnitTestabilityTests.cs (8)
568
Assert.NotNull(controller.ControllerContext.
ModelState
);
587
Assert.Equal(controllerContext.
ModelState
, controller.ModelState);
613
Assert.Equal(controllerContext.
ModelState
, controller.ModelState);
628
Assert.Equal(controller1.ModelState, controller1.ControllerContext.
ModelState
);
631
Assert.Equal(controller1.ControllerContext.
ModelState
, controller2.ModelState);
632
Assert.Equal(controller1.ControllerContext.
ModelState
, controller2.ControllerContext.
ModelState
);
633
Assert.Equal(controller1.ControllerContext.
ModelState
, controller2.ViewData.ModelState);
DefaultHtmlGeneratorTest.cs (10)
590
viewContext.
ModelState
.SetModelValue(nameof(Model.Name), rawValue, attemptedValue: null);
618
viewContext.
ModelState
.SetModelValue(nameof(Model.Name), rawValue, attemptedValue: null);
666
viewContext.
ModelState
.SetModelValue(nameof(Model.Name), rawValue, attemptedValue: null);
694
viewContext.
ModelState
.SetModelValue(nameof(Model.Name), rawValue, attemptedValue: null);
717
viewContext.
ModelState
.SetModelValue(nameof(Model.Name), rawValue, attemptedValue: null);
772
viewContext.
ModelState
.SetModelValue(nameof(Model.Collection), rawValue, attemptedValue: null);
801
viewContext.
ModelState
.SetModelValue(nameof(Model.Collection), rawValue, attemptedValue: null);
827
viewContext.
ModelState
.SetModelValue(
939
viewContext.
ModelState
.SetModelValue(
1034
var viewData = new ViewDataDictionary<TModel>(metadataProvider, actionContext.
ModelState
)
DefaultValidationHtmlAttributeProviderTest.cs (1)
254
var viewData = new ViewDataDictionary<TModel>(metadataProvider, actionContext.
ModelState
)
Rendering\ViewContextTests.cs (2)
70
Assert.Same(originalContext.
ModelState
, context.
ModelState
);