Model Validation

noun

say it: “MOD-ul val-ih-DAY-shun” /ˈmɒdəl ˌvælɪˈdeɪʃən/

ASP.NET Core checking incoming values against the model's rules, and recording any errors in ModelState.

What is Model Validation?

Model validation checks incoming data against rules before your code uses it. With [ApiController] (or minimal API validation in .NET 10), invalid input returns a 400 with the errors.

In a sentence

  • “Model validation caught the empty name before the product was saved.”

Level: Journeyman · More ASP.NET Core terms at this level

Updated