0% found this document useful (0 votes)
52 views5 pages

Data Annotations

Uploaded by

dhruv kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views5 pages

Data Annotations

Uploaded by

dhruv kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 5

.

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.

You might also like