Codesmith generator Code Generator

Source: Internet
Author: User

In order to learn how to use this software, I found that English is not good. All the documents are in English and cannot be understood, I thought about downloading a software. I thought it was all in English. I could not find a friend to learn with me, but I could not understand the English, so that I could remember it, it will be easy to use in the future. I 'd like to write more details. I used a version later than 7.0, and a friend sent me a version later than 6.5, so use 6.5, 7.0 I reported an error when connecting to the database. Therefore, we recommend that you use 6.5. It's really sad. Okay, no nonsense.

Codesmith generator is a template-based code generation tool, which is similar to ASP.. Net syntax to generate any type of code or text. unlike many other code generation tools, codesmith does not require you to subscribe to specific application design or architecture. Codesmith can be used to generate code generated for anything, including a simple set of strong types and a complete application, which can be customized based on the nature of the purpose.

Codesmith generator syntax rules and ASP. net is completely consistent, so you only need to be familiar with ASP. NET technology, you can quickly master the template's syntax rules, codesmith generator can provide high-quality consistent style code in a short time

  • Effectively reduce repeated code
  • Generate code with fewer defects in a shorter time
  • The Code conforms to the specified standard
  • Create a template that can generate any language code

: Http://www.codesmithtools.com/downloads

Download and install the cracked version 6.5

Install the software first. Do not run it after installation. Find the installation path and place the cracking file under the installation path. Double-click the cracking file.

Click Install. If the attack is successful

Okay, the attack is successful, and this occurs when you open the software.

Right-click my templates CSHARP and right-click the newly created file edit.

The next step is to write the template. After writing the template, save it in a place you can find, and then open the file.

Then connect to the database. This is intelligent. If you connect to the database once, it will automatically connect to the database later.

The generated code is

This is some basic operations. Let's write some templates below.

<% -- Name: Database Table entity code generator Author: Guo Lili 876883106@qq.comDescription: -- %> <% @ codetemplate Language = "C #" targetlanguage = "C #" DEBUG = "false" Description = "create a list of properties from database table. "%> <% @ property name =" sourcetable "type =" schemaexplorer. tableschema "Category =" context "Description =" table that the object is based on. "%> <% @ Map Name =" csharpalias "src =" system-csharpalias "Description =" system to C # type map "%> <% @ Assembly name =" schemaexplorer" %> <% @ import namespace = "schemaexplorer" %> <% foreach (columnschema column in this. sourcetable. columns) {%> Public <% = csharpalias [column. systemtype. fullname] %> <% = stringutil. topascalcase (column. name) %> {Get; Set ;}<%}%>

Effect

<% -- Name: Database Table entity code generator Author: Guo Lili 876883106@qq.comDescription: datatime: 2014-08-08 -- %> <% @ codetemplate Language = "C #" targetlanguage = "C #" DEBUG = "false" Description = "create a list of properties from database table. "%> <% @ property name =" sourcetable "type =" schemaexplorer. tableschema "Category =" context "Description =" table that the object is based on. "%> <% @ Map Name =" csharpalias "src =" system-csharpalias "Description =" system to C # type map "%> <% @ Assembly name =" schemaexplorer" %> <% @ import namespace = "schemaexplorer" %> <% foreach (columnschema column in this. sourcetable. columns) {%> private <% = csharpalias [column. systemtype. fullname] %> _ <% = stringutil. tocamelcase (column. name) %>; Public <% = csharpalias [column. systemtype. fullname] %> <% = stringutil. topascalcase (column. name) %> {get {return _ <% = stringutil. tocamelcase (column. name) % >;} set {_<%= stringutil. tocamelcase (column. name) %> = value ;}}<%}%>

Effect

<% -- Name: Database Table entity code generator Author: Guo Lili 876883106@qq.comDescription: datatime: 2014-08-08 -- %> <% @ codetemplate Language = "C #" targetlanguage = "C #" DEBUG = "false" Description = "create a list of properties from database table. "%> <% @ property name =" databases "type =" schemaexplorer. databaseschema "Category =" context "Description =" table that the object is based on. "%> <% @ Map Name =" csharpalias "src =" system-csharpalias "Description =" system to C # type map "%> <% @ Assembly name =" schemaexplorer" %> <% @ import namespace = "schemaexplorer" %> Database Name: <% = databases. name %> creation date: <% = databases. datecreated %> <% foreach (var tb in databases. tables) {%> table name: <% = TB. name %> <% foreach (var cl in TB. columns) {%> column name: <% = Cl. name %> data type: <% = Cl. nativetype %> Data Length: <% = Cl. size %> CTS data type: <% = Cl. datatype %> Description: <% = Cl. description %> <% }%><%}%>

Effect

<% -- Name: Database Table entity code generator Author: Guo Lili 876883106@qq.comDescription: datatime: 2014-08-08 -- %> <% @ codetemplate Language = "C #" targetlanguage = "C #" DEBUG = "false" Description = "create a list of properties from database table. "%> <% @ property name =" sourcedata "type =" schemaexplorer. databaseschema "Category =" context "Description =" table that the object is based on. "%> <% @ Map Name =" csharpalias "src =" system-csharpalias "Description =" system to C # type map "%> <% @ Assembly name =" schemaexplorer" %> <% @ import namespace = "schemaexplorer" %> <% foreach (var tb in sourcedata. tables) {%> [tablename ("<% = TB. name %> ")] <% foreach (VAR pk in TB. primarykey. membercolumns) {%> [primarykey ("<% = PK. name %> ")] <% }%> [explicitcolumns] public partial class <% = stringutil. topascalcase (TB. name) %> () {<% foreach (var cl in TB. columns) {%> [column] Public <% = csharpalias [Cl. systemtype. fullname] %> <% = stringutil. topascalcase (Cl. name) %> {Get; Set ;}<%}%>}<%}%>

Effect

Well, let's write so many templates first. These templates have been written by the supervisor before, but they won't be used and finally learned. Hey, the specific syntax is available on the Internet and needs to be searched online. This is only used in my work.

 

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.