Net Core Agenda 1. Data Annotation Validations 2. Caching 3. Security 1. Data Annotation Validations
Data Annotation is used for data validation for web-based
applications. We can quickly apply validation with the help of data annotation attribute classes over model classes. Package: System.ComponentModel.Annotations Namespace: using System.ComponentModel.DataAnnotations; Jquery : <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery- validate/1.19.3/jquery.validate.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validation- unobtrusive/3.2.12/jquery.validate.unobtrusive.js"></script> • [ValidateNever]: Indicates that a property should be excluded from validation. • [Required]: Validates that the field isn't null. • [EmailAddress]: Validates that the property has an email format. • [Range]: Validates that the property value falls within a specified range. • [Compare]: Validates that two properties in a model match. • [Phone]: Validates that the property has a telephone number format. • [RegularExpression]: Validates that the property value matches a specified regular expression. • [StringLength]: Validates that a string property value doesn't exceed a specified length limit. • [Url]: Validates that the property has a URL format. • [Remote]: Validates input on the client by calling an action method on the server. • [CreditCard]: Validates that the property has a credit card format.