Mid ASP.NET Core

Model validation: data annotations?

Decorate models with attributes:

public class User {

[Required]

[StringLength(50)]

[EmailAddress]

public string Email { get; set; }

Used in both MVC and API for validation.

More from ASP.NET Core Tutorial

All questions for this course