Data Annotation
The [Required]
, [StringLength]
and [RegularExpression]
method decorators in the above code sample are the data annotations.
When do these validations happen
As soon as the model object is instantiated from the request or response data, the data annotation validations are run and if any errors are found, the errors are sent to ModelState
class.
Last updated
Was this helpful?