Академический Документы
Профессиональный Документы
Культура Документы
ITMAWE-404
Data Validation
ASP.NET MVC integrates validation right into the processing of each
request.
MVC Framework validates any data that is passed to that controller action,
populating a ModelState object with any validation failures it finds and
passing that object to the controller.
Controller actions can query the ModelState object to determine whether
the request is valid and react accordingly.
Developers are free to execute their own logic to discover issues that the
framework does not catch and manually add those errors directly using the
ModelState.AddModelError(string key, string message) method.
Explanation:
Data Annotations API provides a set of attributes so that the developers can
use and apply data objects class. The attributes offer a declarative way to know if the
inputs are validated in the rules directly to a model.