28 references to TryAddModelError
Microsoft.AspNetCore.Mvc.Abstractions (4)
ModelBinding\ModelStateDictionary.cs (4)
216return TryAddModelError(key, exception.Message); 303return TryAddModelError(key, errorMessage); 309return TryAddModelError(key, exception.Message); 329TryAddModelError(key, errorMessage);
Microsoft.AspNetCore.Mvc.Abstractions.Test (6)
ModelBinding\ModelStateDictionaryTest.cs (6)
788var result = dictionary.TryAddModelError("key1", "error1"); 820var result = dictionary.TryAddModelError("key1", "error1"); 828result = dictionary.TryAddModelError("key3", "error3"); 832result = dictionary.TryAddModelError("key4", "error4"); // no-op 893var result = dictionary.TryAddModelError("key1", "error1"); 1670var invalidException = Assert.Throws<InvalidOperationException>(() => dictionary.TryAddModelError(key, "errorMessage"));
Microsoft.AspNetCore.Mvc.Core (17)
ModelBinding\Binders\CollectionModelBinder.cs (1)
222bindingContext.ModelState.TryAddModelError(bindingContext.ModelName, message);
ModelBinding\Binders\ComplexObjectModelBinder.cs (3)
122bindingContext.ModelState.TryAddModelError(bindingContext.ModelName, message); 472bindingContext.ModelState.TryAddModelError(modelName, message); 501bindingContext.ModelState.TryAddModelError(modelName, message);
ModelBinding\Binders\ComplexTypeModelBinder.cs (2)
187bindingContext.ModelState.TryAddModelError(bindingContext.ModelName, message); 292bindingContext.ModelState.TryAddModelError(modelName, message);
ModelBinding\Binders\DateTimeModelBinder.cs (1)
79modelState.TryAddModelError(
ModelBinding\Binders\DecimalModelBinder.cs (1)
82modelState.TryAddModelError(
ModelBinding\Binders\DoubleModelBinder.cs (1)
82modelState.TryAddModelError(
ModelBinding\Binders\EnumTypeModelBinder.cs (1)
51bindingContext.ModelState.TryAddModelError(
ModelBinding\Binders\FloatModelBinder.cs (1)
82modelState.TryAddModelError(
ModelBinding\Binders\KeyValuePairModelBinder.cs (2)
64bindingContext.ModelState.TryAddModelError( 73bindingContext.ModelState.TryAddModelError(
ModelBinding\Binders\SimpleTypeModelBinder.cs (1)
122bindingContext.ModelState.TryAddModelError(
ModelBinding\Binders\TryParseModelBinder.cs (1)
73bindingContext.ModelState.TryAddModelError(
ModelBinding\ParameterBinder.cs (1)
187actionContext.ModelState.TryAddModelError(modelName, message);
ModelBinding\Validation\ValidationVisitor.cs (1)
237ModelState.TryAddModelError(key, result.Message);
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
JsonPatchExtensions.cs (1)
54modelState.TryAddModelError(key, jsonPatchError.ErrorMessage);