Http://www.chenjiliang.com/Article/View.aspx? ArticleID = 18928
Since I got started with the MVC three-tier model program, I had always felt that writing modal was a physical labor, so I began to "lazy". At that time I wrote a simple [entity class generator ], later, I improved it a little.
The template of the generated entity class is extracted, instead of being fixed to the Code, so that the generated entity class content can be flexibly processed, use some simple table names to obtain column names or table names,
And the loop segment, but the disadvantage is still not flexible enough. I have also briefly understood codesmith. I personally feel a little troublesome, But I cannot deny the powerful functions of codesmith. Use the machine of this project
Yes, I reorganized my thinking and spent a week completing a small tool-[codemaker code generation tool ].
Features of the codemaker code generation tool:
? Use tags to edit template files
? Plug-in mechanism
? Generate multiple tables
:
(Main interface of codemaker)
For example:
Copy and save
<c:foreach item="column"> public const string <c:value name="ColumnName" rule="upper" /> = "<c:value name="ColumnName" />"; </c:foreach>
The preceding template generates the column names of each column in the database, for example:
Copy and save
public const string USERNAME = “UserName”;
<C: foreach> and <C: value> are the labels defined in codemaker. They are used for loop and value respectively.
A friend who has developed Java may be familiar with the <C: foreach> label. That's right, it's the <C: foreach> In jstl.
Is different from the annotated labels in the Code (for example, <summary>), so a prefix is added. in <C: value>, some attributes operate on the value.
For example, rule = "upper" indicates to change all the values to uppercase.
Plug-in mechanism:
The [Database Support], [template support], [tag support], and [Support for output file types] required by this tool are all in the form of plug-ins, users can define their own labels and template Resolvers
You only need to register the related classes in the configuration file to use them in the project. Because it is the first time to access plug-ins in this form, it is not very good in many places. I hope you can give some comments or suggestions.
The following templates have been tested:
Entity classes and ing files of hibernate (Java) and nhib.pdf (. net c #)
I will improve the tool as soon as possible and then release it. Please download and use the tool as needed. Thank you for your support.
Download codemaker_v0.1.2
Http://files.cnblogs.com/wangzeran/CodeMaker_v0.1.2.zip
Codemaker source code download
Http://files.cnblogs.com/wangzeran/CodeMaker_Src.zip