CodeSmith Generator

What is CodeSmith Generator?
CodeSmith generator is a template-based tool that can produce code for any text-based language. Whether your target language is C#, Visual Basic .NET, T-SQL, Java or even FORTRAN, CodeSmith Generator can help you produce higher-quality, more consistent code in less time than writing code by hand. CodeSmith’s familiar ASP.NET-based template syntax means that you can be writing your first templates within minutes of installing the package. The advanced CodeSmith Generator Explorer integrated development environment (IDE) helps you create and test new templates in a rapid development setting. CodeSmith Generator Projects and ActiveSnippets are integrated within Visual Studio to make code generation a breeze.
CodeSmith also includes a console version and an MSBuild task that you can easily integrate into your automated build process, flexible strategies for merging generated code with custom code, the SchemaExplorer API for integration with relational data sources, and the ability to hook up your own custom metadata sources.

How to use it?
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. This exercise should take you no more than five minutes to complete, but it will introduce you to CodeSmith Explorer, and show you the power of CodeSmith’s template-based code generation scheme.

Why CodeSmith?
CodeSmith’s templates use ASPX-like syntax with a couple of CodeSmith-specific directives. You can create new templates within a few minutes and the best part is that it is all just text so you can edit them and immediately see the results. Using CodeSmith’s templating engine makes the templates more manageable. Instead of storing the generated code in a StringBuilder, constantly appending new lines and worrying about the proper formatting and indenting you can now focus on what the template really must generated and let CodeSmith take care of the rest.

Copyright © All Rights Reserved - C# Learners