Database documentation
Benefit
Database documents can be used not only for reading but also for use.
In the document "informatization Infrastructure Development Framework", intelligent prompt support for improvement is mentioned.
In the SQL query manager, When you hover the mouse over the table name, you can display the comment of the table.
Table creation description
Description of the created Field
That is, if we have designed documents for the database, these accompanying documents will be intelligently carried out during SQL statement writing for your reference.
In addition, these annotations can be taken to C #CodeWhen code is generated, this value is also given to the C # code attribute prompt, which is very good.
As shown in, click Edit next to the column name to bring out the window and edit the prompt content. The final result is as follows:
Then, the Comment file is generated as a database document with one click, and the work of writing database documents is not great.
Since a set of databases may be used by multiple customers, we can use the tool to export the documents of the databases that have been commented out as SQL statements and execute them in other databases, all databases have database documents.
Rational Database Design
The design of the database will affect its readability.
Table design best practices recommended by llbl gen
1. Design a primary key for the table
2. Use the singular name table instead of the plural number. For example, the customer customers, the advantage of doing so is that when using Table Association, naming is not prone to confusion conflicts. For example, if there is an order, it buys raw materials from multiple customers, so that it has a customers attribute.
3. Do not prefix a table or view. For example, the table names tblcustomer, tblsalesorder, and TBL are redundant. We use databases more frequently than views and stored procedures. If you add TBL before the table name to distinguish between tables and views, you can consider adding VW before the view, you can add SP before the stored procedure to reduce the number of prefix letters for tables that are most frequently used.
4. Define the foreign key reference Association.
5. Do not define multiple foreign keys in a single non-primary key field.
6. Use unique value unique values to constrain Columns
7. Do not add a prefix to a field. You can add a type alias before the field, such as iage, indicating that age is int.
8. Give the field a proper name.
9. Define the concurrency mechanism before starting the project
10. Do not confuse unique index and unique constraint
11. Define the 1-to-1 Relationship in the hierarchy of Inheritance
12. Consider using views to replace a large number of relationships.
Name construction specific settings ORM designer name settings
- Enforcepascalcasingalways (true) force Pascal rules
- Entityfieldnamestrippattern ({}{}) entity field name removal Mode
Field naming rules
- Entitynamestrippattern entity removal mode {TBL _} {_ Dev}. Default is {TBL _}{}
For tables whose names are tbl_employee, the entity name automatically removes the TBL _ prefix.
For Table names ending with _ Dev, The _ Dev suffix is automatically removed from the object name.
- Fieldmappedonmanytomanypattern Multi-to-Multi-field construction mode {$ startentityname} {$ intermediateentityname} {$ endentityname $ p}
$ P or $ s suffix singular and plural pluralize singularize
- Fieldmappedonemanytoonepattern {$ startentityname} {$ endentityname}
- Fieldmappedonetomanypattern
- Fieldmappedonrelatedfieldpattern
- Makeelementnamepascalcasing (true ).
Lowercase letters, except the first letter and the first letter after the boundary ('_' or '').
- Storedprocnamestrippattern Stored Procedure naming removal mode {Pr _, SP _}{}
- Typedviewfieldnamestrippattern
- Typedviewnamestrippattern {vw _} {_ Dev}. Default is {vw _}{}
- Removeunderscoresfromelementname (true) Remove the underline