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:
- Control prefix
- Formfrm
- Classcls/C
- Modulemod
- Labellbl
- LinkLabellnk
- Buttonbtn
- TextBoxtxt
- CheckBoxchk
- RadioButtonrad
- GroupBoxgrp
- PictureBoxpic
- Ripgrd
- ListBoxlst
- CheckedListBoxclst
- ComboBoxcbo
- TreeViewtvw
- ListViewlvw
- TabControltab
- DateTimePickerdtp
- Timertmr
- Splitterspl
- ProgressBarpbar
- RichTextBoxrtf
- ImageListimgl
- ToolBartlb
- 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:
- url=”XXXX.aspx?pstrLine=bbbbb&pintNum=11”
-
- DimlstrLineasstring=Request(“pstrLine”)
-
- 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:
- Global. asax file:
-
- Subsession_star (byvalsenderasObject, byvaleasEventArgs)
-
- Session ("gstruser") = ""
-
- Endsub
-
- Subsession_End (byvalsenderasObject, byvaleasEventArgs)
-
- Session ("gstruser") = nothing
-
- 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:
- Stringstr
- Datedat
- Booleanbln
- Shortsht
- Decimaldec
- Longlng
- Integerint
- Bytebyt
- Charchr
- Singlesgl
- Doubledbl
- Structureudt
- Objectobj
- DataSetds
- DataRowdr
- OleDbConnectionconn
- SqlConnectionconn
- OleDbCommandcmd
- SqlCommandcmd
- OleDbDataAdapterda
- SqlDataAdapterda
- OleDbDataReaderrdr
- SqlDataReaderrdr
- 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.