The CodeSmith Generator Tutorial includes the various sections which will quickly help you become a master of Code Generation. Although there's a lot of depth to CodeSmith Generator, you can get started with it quickly. In this section of the documentation, we'll walk you through a few common code generation scenarios.

Getting Started

The best way to understand the power of CodeSmith Generator is to try it out. Although CodeSmith Generator has many advanced features, you can begin using it to help produce code without mastering all of those features. In this section, you'll learn how to use Generator to generate a useful piece of utility code - specifically, a strongly-typed hash table class. 

Writing your first Template

Knowing how to execute templates that others have written is the first step towards getting started with CodeSmith Generator, but to realize the full benefit of CodeSmith Generator in your day to day development tasks, you'll need to write your own templates. In this tutorial, you'll learn how to do just that, working through the entire process of writing a CodeSmith Generator template from start to finish.

Write a Template with Database Metadata

One of the key uses for code generation is to build code based on database schema. CodeSmith Generator enables this scenario through the use of the SchemaExplorer assembly, which provides types for working directly with SQL Server or ADO data as well as designers that can be used to access those types from CodeSmith Generator. In this tutorial, you'll see how you can use the information available through SchemaExplorer, together with scripting code, to make short work of building a complex T-SQL script.