Naming Conventions for database entity classes

Source: Internet
Author: User

Assume that the tag table and post table
Tag table
ID
Name

Post table
ID
Title
Author
Adddate
Tagid

Entity class
Tag
ID
Name

Post
ID
Title
...
Tag
Fields are in the attribute _ format.

Then some people look like this.
Tag
Tagid
Tagname

Post
Postid
Posttitle
Postauthor
Postadddate
Posttagid

Someone else is like this.

Tag
Inttagid
Strtagname

Post
Intpostid
Strposttitle
Strpostauthor
Strpostadddate
Intposttagid

Some people look like this.
Tag
Intid
Strname

Post
Intpostid
...

In addition, some people adddate will write "add_date" and add a _ line, which will be converted into "date_add_date. pretty dizzy ".

When ing to an object class, it also contains the attributes of the int object.

I have always been the first, mainly from (directly understanding efficiency and aesthetic considerations)
The first kind of optimization is in terms of viewing comfort and efficiency. You can click it to get the desired attributes at once, instead of having to continue the selection like the two following ones.
I feel that the last one is helpful when I used SQL very often. I know the assignment type clearly. But now I want to quit. The times have improved.

Then, when the object class is displayed

First, I am the id Primary Key... attribute, the foreign key property set attribute. Finally, I use my own method to use castleCodeThis is also the norm when the code is generated. If the code is run in disorder, it will be quite depressing to modify the bug and change the code.

Fortunately, most people refer to the more popular C # encoding standards. Most of them see the same style.

Whether you achieve the best code efficiency... save time for thinking

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.