WisDom. Net Framework Design (7) Verification Framework

Source: Internet
Author: User

WisDom. Net-Verification Framework

 

1. CategoryHere we divide data verification into the following types:

  • Data Type verification is mainly used to ensure that the data type input is correct, for example, the input age is A year old, obviously illegal
  • The domain check is mainly used to verify whether the input data is in the value range. For example, if you enter 400 for an age item, it is obviously invalid.
  • The format check is mainly used to check whether the data format is correct. For example, the Email input Ca is obviously invalid.
  • Custom check and custom validation data. For example, check whether the data format is legal.

 

2. Introduction

As a standard building, it is implemented based on the Attribute of the class attributes (here only the length verification is implemented, and others are to be extended)

3. Call Method

 

   public class Demo    {       [MaxLength(5)]       public string MaxName { get; set; }    }

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.