Codesmith tutorial -- getting started with codesmith

Source: Internet
Author: User
Technorati label: codesmith
, Ol_beta
, Tutorial

The best way to understand codesmith is to try. You can try to use codesmith before you know all of its features. In this section, you will learn how to use codesmith to generate a piece of useful utility code-especially a strongly typed hash table class. This work should take up to five minutes to complete, but will introduce you to codesmith explorer and codesmith studio, and show you the right to generate a template-based code solution in your codesmith.

One way to start a code generation session is the resource manager in codesmith. Just as the windows Resource Management Service organizes files and folders to be stored on a computer, codesmith Resource Service organizes templates. To select resource manager from the codesmith Startup Program menu in codesmith, select resource manager in codesmith. It displays the installed codesmith template.

A template is part of the code generation. You can use the codesmith template to generate code, or use codesmith to develop your own template.

The. CST file extension represents the "codesmith template". For example, the cshashtable. CST template generates the C # code of the hash table class. Double-click this template (or right-click and select execute) to open it.

The codesmith template uses attributes to allow you to customize the generated code. When you open the resource manager in a template codesmith, all the attributes displayed in the template's attribute table. You need to provide the values of these attributes, and then codesmith can generate code for you. The cshashtable template requires four string attributes (category, classnamespace, itemtype value and keytype) and one enumeration attribute. You can enter any value as the same as the string property. For the first experiment, enter the attribute table as follows:

Click Generate. The code generated based on the template and attributes is displayed on the right.

You can paste the code into your file, or click Save to save it.

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.