Description of [a WF-based business process platform] Table Design

Source: Internet
Author: User

 

 

Database primary key design description

In my release example, a WF-based business process platform,

 

N12345B

//

Almost all data structures use the Guid data type as the ID. Does this ID only serve as the serial number? This ID is not used for the relationship between all tables, and xxxNo is used.

//

 

Here, I will explain the reasons for using this Guid

Why do I add a Guid column to each table?

This is because I want to process concurrency, which is described as follows:

The Guid column is used to ensure that each record has a unique identifier in the fully-Open Database,

 

I usually maintain such a table in the memory as needed

 

Guid

UserID

State

76C43F0D-F39E-458b-9E40-D4D70703FF2E

001

 

76C43F0D-F39E-458b-9E40-D4D70703FF2E

002

 

76C43F0D-F39E-458b-9E40-D4D70703FF2E

003

 

 

When a user [001] queries a record, if the user selects the option [notify me immediately after modification by another user.

The server adds the Guid and UserID of the record queried by the user to the table above.

 

After a record is modified, the system will go to the table above to check whether the Guid of the record is registered. If it is registered, a notification will be sent to the corresponding UserID.

 

Of course, this is only an application of this Guid. I also use this Guid when doing concurrent modification arbitration. In this regard, I will write a special article to introduce it later.

 

Why do Guid columns have primary keys?

Despise your laziness first (^_^)

 

When using Linq To SQL, the table's primary key cannot be modified, so I use Guid as the primary key, and the Business primary key makes me a unique key.

 

 

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.