Dynamic Soft code generation tool

Source: Internet
Author: User

Dynamic Soft Combat strategy

Teach you to use soft

Document Number: 20110421

Copyright ©2004-2011 Dynamic Soft

Online Help: Http://help.maticsoft.com

Directory

A. Product Introduction

two. Download Installation

three. Registering a database connection

Four. View database Information

Five. Create a new entire project

Six. Bulk Code generation

Seven. Single-table code generation

Eight. Parent-child Table code generation (transaction Generation)

Nine. code generation rule Settings

10. automatically generate stored procedures

11. automatically generate database SQL scripts

12. Building a database document

13. Common Tools

1. Search Table function

2. Project release function

3. Code conversion function

14. code Generation component Interface Development

Frequently Asked questions (click the link below to view the details)

A. Product Introduction

Dynamic soft. NET code generator is a model for. NET programmer design Automatic code generator, is also an intelligent software development platform, it can generate based on object-oriented thinking and three-layer architecture design code, combined with the software development of classical ideas and design patterns, incorporating the factory model, reflection mechanism and some other ideas. The main implementation of the table in the corresponding database of the base class code automatically generated, including the generation of attributes, add, modify, delete, query, existence, model class construction and other basic code snippets, support different architecture code generation, so that programmers can save a lot of mechanical input time and duplication of labor, Focus on the development of core business logic. The Soft code generator also provides convenient development management capabilities and accessibility features commonly used in many development tasks, making it easy and easy for you to develop your project.

Soft makes software development easier and happier! Let enterprises continue to improve development efficiency, the same time to create greater value.

two. Download Installation

    1. System Requirements :
      Microsoft WINDOWS2000/XP/2003/7 or higher. The machine must have the. NET Framework v2.0 installed.
    2. Official: http://www.maticsoft.com/download.aspx
    3. Download the following files after unpacking the installation package:

Codematic2.msi is soft. NET code generator installation files.

Builder folder is the code generation plug-in source, dynamic soft. NET code generator supports extensible code generation plug-ins, users can customize their own code-generated plug-ins, according to the interface to develop their own code generation method, according to their own requirements for code generation.

Codematic_data.mdf and Codematic_log.ldf are the database files that are required to move the management module in the new project. Background Administrator default login user name: admin Password: 1

    1. Double-click codematic2.msi to install directly.

When installing the soft, if the user machine 360 pop-up warning, it is only a signature authentication prompt, not a trojan, select "Continue to install", and then click "OK".

Dynamic Soft Solemn statement : soft . NET Code generator, no plug-in Trojan, pure green software. Please feel free to install.

    1. After successful installation, there will be soft on the Start-menu and desktop. The icon for the net code generator.

three. Registering a database connection

After the installation is complete, the first thing to do is to register the database connection, because all code generation will get data structure information from the database to generate.

    1. In the Database View window on the left side of the software interface, select "Server" and right-click the menu:

Or click the 1th button

    1. Select Add Server, and the Select Database Type window appears

    1. Depending on your situation, select a database type that is in use on a machine or in your own project. And make sure that the database you select is normally accessible. Then, "Next".
    2. If you selected SQL Server, you will receive:

Precautions:

(1) Enter the server IP address, if it is this machine can also be: (local) or. or 127.0.0.1.
If the server does not have only one default instance, connect as: Server \ Instance name.
(2) Be sure to select the option that is consistent with the actual database server version, or it will cause connection database errors.
Note: Use the enterprise or official version of SQL Server, which cannot be connected without the express version.
(3) Authentication can be either SQL Server authentication or Windows authentication.

(4) Enter the database server user name password. If you do not know, please contact your database administrator.
(5) If the database table is more, the connection speed will be slow, enable "efficient connection mode" for fast connection.
(6) The connection/test can be connected to the server and get a list of the database, so that you can only choose to connect a library to operate, reduce unnecessary connection time, improve productivity.

    1. If you are selecting Oracle

Enter the administrator username and password for the oracle that you installed yourself, the service is the Oracle service name that is installed, typically the machine name where Oracle is located, and if you are unsure, contact your database administrator.

    1. If MySQL is selected

    1. If you are selecting OLE DB

In the Address text box, you can enter the file address of the Access library directly, note that the library file is not placed on the desktop as much as possible, and make sure that your file address is correct. If your access does not have a password set, the following password can be used without a control.

    1. If you are choosing SQLite

    1. After the above steps are determined, move soft. The database view of the net code generator appears with information about the database server.

Four. View database Information

    1. Right-click on the database and browse the database to view information about tables and fields by selecting libraries and tables.

    1. Select the new Query menu, which appears as a Query Analyzer window for SQL, and you can enter SQL statements to query.
    2. On the table, right-click Browse Table data to view the data contents of the table.

Five. Create a new entire project

After looking at the basic database management functions, we can begin to generate code.

First, the general first generation, we want to build the entire project framework.

    1. Select the database, and then right-click New Net project, or directly click the shortcut icon on the toolbar.

    1. Then, select the project type and version:

L Simple three-layer structure: generate a standard three-tier architecture project.

L Factory mode structure: Generates a project schema based on the factory pattern, suitable for a project multi-database type situation.

L Simple three-layer structure (management): to generate a standard three-tier architecture project, and with basic system management functions and interfaces, these common functions are mainly to save developers time, on this basis directly to develop their own business modules.

The example of "simple three-layer structure (management)" is described here.

    1. Click "Next" to select the tables and configurations you want to generate:

Double-click to select the table you want to build and choose to the right list box. Then click "Start Build".

If you need to modify some configuration you can modify your own namespace name, whether to remove the table prefix.

Code template component type, general beginner recommended by default.

Description of related components:

Builderdalparam Data Access Layer (DAL) code generation component based on parameter mode (recommended)

Builderdalproc Data Access Layer (DAL) code generation component based on stored procedure mode

Builderdalsql Data Access Layer (DAL) code generation component based on SQL stitching

Builderdaltranparam Data Access Layer (DAL) code generation component with transactions

Dal because of different project requirements, according to the project needs, choose one of the methods.

Builderbllcomm Standard-based business Logic Layer Code (BLL)

Buildermodel code generation components for the model layer

Builderweb code generation component for the presentation layer

Note: The code also has some build rules that are set in the menu tools-Options-code generation settings.

    1. Click "Start Build" to start the code generation

Until the project project builds successfully prompt appears, the project is completed.

    1. Open a generated folder

    1. Double-click the solution file to open the entire project

Note: "Simple three layer structure" is currently VS2005 version, is to be compatible with 2005 of friends currently. If you are using VS2008, after you build the project, open the VS2008, choose menu-File-open project, you will be prompted to upgrade the project version, choose to upgrade the project version to VS2008 or VS2010, there is no effect on the code.

    1. Open the Web project, select the Pages folder for the tables you just selected, right-click "Include In Project"

    1. Open the Web project, and modify the database connection string.

Note: After you create a new project, remember to attach the database file codematic_data.mdf that came with the installation package to SQL Server first.

If encryption is required, you can use the Add and Decrypt tool in the installation package (the tool is officially downloaded).

    1. Then, select the solution to regenerate the entire solution. The entire process of creating the project is complete.

    1. If the compilation has no errors, press F5 directly to run. The entire process of creating the project is complete.

Run Start login page login.aspx, enter user name: admin, Password: 1

That is, login to the background of the soft system framework, the interface is as follows

Six. Bulk Code generation

The new project feature is only suitable for the first time because it is not possible to create a new project every time, especially if the project is already in development. Therefore, more application in future project development is the "Batch code generation" function. Bulk code generation is especially useful for post-project append code.

    1. Select the database or table, and then click the context menu "Code batch Build"

    1. The window that appears is basically similar to the new project, except that you have one more option for the selected schema.

Note: The code also has some build rules that are set in the menu tools-Options-code generation settings.

    1. Select the table that you want to generate, and then tap Export
    2. In the generated folder, we can see:

Bulk code generation generates code for business tables, no solution files and project files, and other class libraries. We can drag the resulting files directly into the existing solution.

Seven. Single-table code generation

In addition to new projects and bulk code generation, occasionally we want to personalize some code-generated fields instead of all auto-generated, which we can consider for single-table code generation.

    1. On the left "Database View", select Table, right-click menu "single Table code generator"

    1. Then, a single-table code generator interface appears, and we set up the information we need to change.

Option Description:

    • project name : used primarily in the Generate DB script.
    • Level Two namespaces : This class is placed under a level two folder, so the name of the folder should be in the namespace.
    • top-level namespace : is the namespace name of the project.
    • class name : You can define your own name according to the table name.
    • type : Primarily what code is generated, the DB script primarily generates tables of stored procedures and table creation scripts and data scripts.
    • Schema Selection : Only 3 of the most commonly used architectures are currently supported.
    • code type : refers to the generation of code in a specific project in a specified schema.
    • Code Template Component type : Refers to the way the code is generated, because even if the same code has a lot of wording, the main implementation of the component is different, but each style of implementation of the function is the same. Mainly look at the project needs and personal habits to choose.
    • method Selection : Refers to the generation of the most basic method of adding and removing changes to the code, subsequent versions will support users to customize these methods.

Note: The code also has some build rules that are set in the menu tools-Options-code generation settings.

    1. Then, click the Generate Code button to generate the code for that class:

The generated code can be copied directly into the project file, or you can right-click to save the CS file.

You can switch design views and code back and forth through the tab button below the form.

Eight. Parent-child Table code generation (transaction Generation)

In daily development, the situation of parent-child tables is often encountered, and the record-keeping of parent-child tables needs to be implemented in the transaction to ensure the consistency of the data. The dynamic is also in the functional aspects of this consideration.

    1. On the table, right-click, select Parent-child table code generation (transaction):

Code generation for parent-child tables in 3-step form: three-to-one, the first form primarily sets the parent and child tables, and the fields associated with their primary foreign key.

    1. Then, select "Continue Setup"

    1. Click "Generate Class Code":

All of the INSERT statements here will be done in a single transaction.

Nine. code generation rule Settings

Open the Menu "Tools"-"Options"-"code Generation Settings"

After these configurations are saved, the code is generated as it is generated.

The rule setting for code generation is still increasing in scope.

In addition, there are different data types for different database types, which provide a mapping between the field types and the types in C #, and the type of Code field properties that will be generated by mapping relationships when generating code.

10. automatically generate stored procedures

For users who are accustomed to using stored procedures, the process of adding, deleting, changing, and checking the handwriting table is also a very big thing, and the dynamic soft provides a stored procedure script generation that can automatically generate data table additions and deletions.

It is generated mainly through the following places:

    1. Single-table stored procedure generation:

On the table, right-select "Build Stored Procedure"

Or, right-click on the table and choose the Single-table code generator, which gives you more flexibility in defining the build stored procedure.

    1. Stored procedure generation for bulk tables.

On the database, right-click, select Generate stored procedure, or select Export file-stored procedure. Will generate stored procedures for all tables in the entire database.

11. automatically generate database SQL scripts

Sometimes you need to migrate the database, or generate table structure scripts, export data scripts to other databases, daily development is also more common, this can be soft automatically generated SQL script function to help you save a lot of time.

It is generated mainly through the following places:

    1. Single-table data script generation

Right-click on the table and select "Generate Data Script"

Alternatively, right-click on the table and select "Single-table code generator" For more flexible definition of build stored procedures

After the build:

    1. Data script generation for bulk tables.

The Generate SQL Database Script window appears, select the saved file name, and click "Generate".

    1. Generates a data script based on the query results.

Sometimes we do not like to generate the entire table of data script, perhaps the table is large, or other data do not need, just need some of the data we need, after generating the script, execute import into other libraries, this time we can use the dynamic Soft code generator this function.

On the database, right-click New Query, or choose Menu Tools-Query Analyzer, open the Query Statement window, enter our query statement, then right-select the Generate Data script for current query results:

The generated script only includes the data script for the result of the statement query:

So convenient function, have to say very intimate oh.

In addition, we can see that there is also a very intimate feature, that is, if the data access layer is using a SQL stitching method of the DAL, sometimes in order to spell a long SQL statement, the eyes look at the flower, look at the dynamic soft this function:

In Query Analyzer, test our query statement, and then right-select "Generate stitching code for the current query SQL statement"

After the build, the code we can directly copy to the data access layer, no longer by hand to knock, save time we can go to drink coffee.

12. Building a database document

Daily development, table one more, is not on the headache of each field what meaning, as well as the database always change, document maintenance is very troublesome. Especially when the newcomer joins the project team, if there is no database document, then it is foggy not clear the meaning of various data. Dynamic soft. NET code generator, can help you solve this problem, it can be based on the selected database and table batch generation of all the table field details, including the default value, description and other table structure information. Eliminate the hassle of manual documentation and maintenance, really don't have to work overtime to stay up late, can go home early.

    1. Select the database that you want to build, and then select the toolbar Generate Database document button.

    1. Then, select the tables you want to build

Here are two forms of documentation, one in Word format, but requires native installation of Office2003 or 2007. Another is the Web page format, you can generate two kinds of Interface style Web page format database documents.

13. Common Tools

    1. 1. Search Table function

    1. 2. Project release function

When the Web project is developed, we generally need to publish the project to a test server or production environment, but when we publish, we just want to publish the files we need to publish, or we don't want to publish some files we don't need. Although the vs.net has the release function, but sometimes feel that the use is not so flexible and convenient, dynamic soft provides this function, allowing you to more flexible, simple publishing site files.

Choose Menu Tools-Web Project Publishing

Click the "Settings" button, we can set the rules for publishing.

    1. 3. Code conversion function

This is an earlier version of the left a code conversion tool, can support C # code to VB code conversion.

14. code Generation component Interface Development

Dynamic soft. NET code generator supports extensible code generation plug-ins, users can customize their own code generation plug-in according to the interface, develop their own code generation method, code generation on demand.

The source of the component can be downloaded in the installation package to see or go to the official website to download.

Development steps:

1. Reference
The Lib folder provides an interface class library that adds a reference to 4 DLLs:
Ltp. CodeHelper.dll
Ltp. IBuilder.dll
Ltp. IDBO.dll
Ltp. Utility.dll

2. and using in the class

Using LTP. Utility;
Using LTP. idbo;
Using LTP. Codehelper;

3. Inherited

Dal data Access Layer Template component: public class BUILDERDAL:LTP. Ibuilder.ibuilderdal
BLL business Logic Layer Template component: public class BUILDERBLL:LTP. Ibuilder.ibuilderbll

4. Interface method

Specific reference plug-in source project. The source code for the plugin is provided in the installation package.

5. Using configuration

Tools-Options-component management


In the code parameters or Code generator window, you can see the following list of plug-ins:

Frequently Asked questions (click the link below to view the details)

§ Code generator generated by the partial keyword extension

§ Soft left tree menu navigation, not normal display?

§ Move soft new project (sample project) How do I log in?

§access cannot update data solution with OleDbParameter

§ Dynamic Soft Dbutility class library dbhelpersql for multi-database connection

§ Move soft. NET code generator start error Exit workaround

Summary of several issues §asp.net1.0 upgrading ASP. NET 2.0

§ Sample project source code cannot create a common error description for an object instance

Dynamic Soft code generation tool

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.