Business verification design in system design 4

Source: Internet
Author: User

Framework Structure of business Verification Code
Delegated business Verification processing:
Public Delegate function rulehandler (byval target as object, byval e as ruleargs) as Boolean
Target: The data object to be processed.
E: Verify the rule parameter. This parameter will guide the execution of the verification method. This parameter must contain at least the name of the data item to be verified on the target and other verification conditions.
<Serializable ()> public class ruleargs
Private mpropertyname as string
Public readonly property propertyname () as string
Get
Return mpropertyname
End get
End Property
Public sub new (byval propertyname as string)
Mpropertyname = propertyname
End sub
End Class

Create a verification rule Manager. The verification rule Manager uses the verification name to manage the verification rules (which must be applied to hybriddictionary). The management of verification includes at least adding verification and performing verification.
Public class rulesmanage
'Add verification rules. All verification rules are saved by hybriddictionary.
Public sub addrule (byval handler as rulehandler, byval rulename as string, byval ruleargs as ruleargs)
'Perform verification. The verification execution is completed by the rulehandler stored in hybriddictionary. The target processing is guided by rulename, and rulename corresponds to ruleargs, ruleargs contains the name of the verification data and other verification criteria
Public sub checkrules (byval target as object, byval rulename as string)
End sub

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.