Brief Analysis on naming rules of ASP. NET Programming specifications

Source: Internet
Author: User

What are the naming rules for ASP. NET Programming specifications? What is the specific content? Let's start:

ASP. NET Programming specification naming convention 1. Button ID naming:

Btn + button operation function such as btnSave)

Naming rules for ASP. NET Programming Specifications 2. Other controls:

I. It is related to data operations: Its ID <. SPAN> is the corresponding field name. If multiple controls correspond to one field, the name is as follows:

Field name + "_" + sequence number (starting with 01)

Example: The page contains a TextBox Control that corresponds to the RightGroup field in the database table. Its ID should be named RightGroup.

If the page has two TextBox controls that correspond to the PowerGroup field in the database table, the IDs are named PowerGroup_01 and PowerGroup_02 respectively.

II. Others: prefix + usage functions such as txtInput). For the prefix, see the following:

 
 
  1. Control prefix
  2. Formfrm
  3. Classcls/C
  4. Modulemod
  5. Labellbl
  6. LinkLabellnk
  7. Buttonbtn
  8. TextBoxtxt
  9. CheckBoxchk
  10. RadioButtonrad
  11. GroupBoxgrp
  12. PictureBoxpic
  13. Ripgrd
  14. ListBoxlst
  15. CheckedListBoxclst
  16. ComboBoxcbo
  17. TreeViewtvw
  18. ListViewlvw
  19. TabControltab
  20. DateTimePickerdtp
  21. Timertmr
  22. Splitterspl
  23. ProgressBarpbar
  24. RichTextBoxrtf
  25. ImageListimgl
  26. ToolBartlb
  27. MenuItemmnu

Naming rules for ASP. NET Programming Specifications 3. Naming rules for variables and constants:

I. Page and process-level variables: Level identifier + Data Type prefix + <noun | noun combination>

A. Page-level variables: The level identifier is m (example: dimmstrNewlineasstring)

B. Process-level variables: The level identifier is l (example: dimlstrNewlineasstring)

II. Inter-page variables: obtained through request transmission

Naming principles: Level mark + Data Type prefix + <noun | noun combination>

The level is p.

Example:

 
 
  1. url=”XXXX.aspx?pstrLine=bbbbb&pintNum=11”  
  2.  
  3. DimlstrLineasstring=Request(“pstrLine”)  
  4.  
  5. DimlintNumasinteger=request(“pintNum”) 

III. Full-level variables: Level identifier + Data Type prefix + <noun | noun combination>

A. Level ID: g (example: dimgstrNewlineasstring)

B. because it can be used on all pages, there must be long enough names to describe the variables and add comments

C. define them in the module.

D. The definition of Full-level variables must be approved by the project supervisor before they can be implemented.

IV. Common variables: Use session assignment

A. Naming principles: Level mark + Data Type prefix + <noun | noun combination>

B. Level ID is g (example: session ("gstrNewline") = "")

C. because it can be used on all pages, there must be long enough names to describe the variables and add comments

D. The general variables are stored in Session_Start (sender, e) in Global. asax. The initial value is assigned a null string. And release it in the Session_End (sender, e) process.

Example:

 
 
  1. Global. asax file:
  2.  
  3. Subsession_star (byvalsenderasObject, byvaleasEventArgs)
  4.  
  5. Session ("gstruser") = ""
  6.  
  7. Endsub
  8.  
  9. Subsession_End (byvalsenderasObject, byvaleasEventArgs)
  10.  
  11. Session ("gstruser") = nothing
  12.  
  13. Endsub

E. Definitions of common variables must be approved by the project supervisor before they can be implemented.

V. For the Data Type prefix, see the following:

 
 
  1. Stringstr  
  2. Datedat  
  3. Booleanbln  
  4. Shortsht  
  5. Decimaldec  
  6. Longlng  
  7. Integerint  
  8. Bytebyt  
  9. Charchr  
  10. Singlesgl  
  11. Doubledbl  
  12. Structureudt  
  13. Objectobj  
  14. DataSetds  
  15. DataRowdr  
  16. OleDbConnectionconn  
  17. SqlConnectionconn  
  18. OleDbCommandcmd  
  19. SqlCommandcmd  
  20. OleDbDataAdapterda  
  21. SqlDataAdapterda  
  22. OleDbDataReaderrdr  
  23. SqlDataReaderrdr  
  24. CrystalReportrpt 

Naming rules for ASP. NET Programming specifications 4. process functions) Naming rules:

I. Naming rules: Level mark + <glossary>

II. apply to a single page: The level ID is p (example: privatefunctionpDisdata ())

III. apply to all pages: The level ID is g (example: publicfunctiongDisdata ())

Naming rules for ASP. NET Programming specifications 5. Page naming rules:

Module ID + program function abbreviations

I. Example: There is a basic data module. The module is identified as Base. If the program is abbreviated as unit, the page name is Baseunit.

II. This name can only be set by the project supervisor or System Analysis

Naming rules for ASP. NET Programming Specifications 6. Naming rules for stored procedures:

I. Naming rules: [two letters before the project name] + [abbreviation of the program] + [_] + [Stored Procedure Function Identifier]

II. If the project name is in upper case, convert it to lower case

III. Example: if the project name is DKERP and the program name is unit, the stored procedure is saved and can be named dkunit_Sav.

IV. Stored Procedure Function Identification conventions:

◆ The stored procedure is saved and marked as Sav

◆ If the stored procedure function is deleted, it is marked as Del

◆ The stored procedure is queried and identified as Qry

◆ The stored procedure function is filled into the control and marked as Back

◆ The stored procedure function is bound to the drop-down box control, which is identified as Dll

V. The naming and planning of stored procedures must be approved by the project supervisor before they can be implemented.

ASP. NET Programming Specifications 7. Class naming rules:

I. Principle: [Cls] + <noun | noun combination | dynamic noun combination>, noun | the first letter of the verb in uppercase

II. Example: ClsDataOperate

III. Definitions and naming of public classes must be approved by the project supervisor before they can be implemented.

ASP. NET Programming specifications naming conventions 8. Module naming conventions:

I. Principle: [Mod] + <noun | noun combination | dynamic noun combination>, noun | the first letter of the verb is capitalized.

II. Example: ModDataConnection

III. Definitions and naming of Public modules must be approved by the project supervisor before they can be implemented.

Naming rules for ASP. NET Programming Specifications 9. User Control naming rules:

I. Principle: [url] + <noun | noun combination>, noun | the first letter of the verb is capitalized.

II. Example: urlDataLoad

III. The definition and naming of user controls must be approved by the project supervisor before they can be implemented.

The naming conventions of ASP. NET programming standards are introduced here. I hope these contents will help you understand the naming conventions of ASP. NET programming standards.

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.