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