Added the view code generation and master-slave Table Interface Generation functions to the Code Generation Tool Database2Sharp.

Source: Internet
Author: User

Added the view code generation and master-slave Table Interface Generation functions to the Code Generation Tool Database2Sharp.

In the various functional plans of the code generation tool, we are always driven by the customer's needs, so we will also add some special features or processing as needed. In actual development, although we generally develop specific services with specific tables, it is also common for some customers to develop views. To improve the efficiency of code generation and interface generation, the view-based development process should also be supported. There are also page generation operations for Master/Slave tables, which are also common in many practical business fields. Based on the above requirements, the Code Generation Tool Database2Sharp adds the view code generation and master-slave Table Interface Generation functions, to ensure efficient development and escort for customers.

1. View-based code generation and Interface Generation

To support view-related code generation, we optimized and integrated the underlying metadata of the code generation tool, which means that the specific tables and views are no longer specific differences in code generation, basically, they can be treated in a unified manner to achieve rapid framework code generation, Winform interface generation, and Web interface generation operations. All table-related attributes and views also have, therefore, the code template is convenient, does not need to be adjusted, and is compatible with the code template attribute processing, improving the security of existing code templates.

As shown above, in order to distinguish between the table and view positions, we put the view behind the table to facilitate selection and processing. During the selection, both the table and view are treated equally, therefore, the process of code generation applies to tables and views, and can be generated in a unified manner, greatly improving the efficiency of code generation.

Of course, the addition, deletion, and modification operations of views are different from those of tables. Generally, views only display data for query purposes. Therefore, during actual development, You can properly block the addition, deletion, and modification operations of views, or customize related interfaces for processing.

When the Winform interface is generated, we also integrate the View list to generate interface code based on The View.

However, we have noticed that in general tables, we use the remarks information as the field description information on the Winform interface. If it is a view, we cannot obtain its view field remarks, because the field remarks of the view do not exist, in order to implement the interface that has the same Chinese remarks as the table, we have added an interface for maintaining the remarks of the view field with the remarks of the field, when we generate the Winform interface, the tag of the corresponding field contains Chinese information.

The code generated through the Enterprise Library Architecture also has related remarks, as shown in the following code.

Use the Winform interface code generated in the code generation tool. Of course, there will also be related remarks. The corresponding Chinese label information can be displayed on the interface.

The Winform interface code generation of the view is the same as that of the Winform interface generated by a common table. The specific interface operations are as follows.

In this way, the generated Winform interface operations are the same as that of normal tables, and the corresponding View fields also have remarks. Therefore, the label description on the interface is the same as that on the table, the remarks are displayed.

 

2. Create a Master/Slave table

In some cases, some business tables have a master-slave relationship, such as summary information and details, such as warehouse receiving and warehouse picking operations and member consumption operations, they are typical master-slave tables and can be processed as a case generated on the interface.

The standard Master/Slave table interface is shown in the following figure.

Or the member consumption information is displayed as follows.

In my previous code generation interface, we mainly generate standard page list display and edit details. to enrich the interface generation of development tools, based on the synthesis of the above two interfaces, you can add a master-slave Table Interface Generation operation to better adapt to the actual business development work and efficiently generate interfaces quickly.

In the code generation tool, set the master-slave Table Interface Generation as follows.

After the Winform interface code is generated, you can see the following interface in the VS editor.

Finally, run the generated interface in the actual program to see the preview interface effect, as shown below.

For convenience, a check box is added on the interface to switch between the horizontal and vertical display details lists. After the check box is selected, it is displayed horizontally, as shown below.

The preceding master-slave table displays the summary function of the detail table information, which basically satisfies the information display of the master-slave table. If necessary, you can also make more convenient improvements on this basis.

 

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.