Working with CodeSmith for two days
I was part of a team that was tasked with CodeGen at work. The intended
goals were to gen as much as we could, staying within our coding standards, and
utlizing as much of our common code as possible. With these goals in mind,
the research began. After looking at a number of "turn key" gen tools
(mostly O/R mappers), we realized that most, if not all of the turn key options
required that we subscribe to their procedures. This was not going to be
sufficient since we had existing code and designs that we were looking to gen on
top of.
So I started to look at CodeSmith as a possible option. After putting
together some prototypes of templates, I was pretty much able to get to the 50%
mark on the entire CodeGen project in about 2 days. After a few Aha!
moments, I was cruising. I still have quite a bit to do, but I have been
amazed with how quick it was to learn, and how flexible it is.
For example, we were in a position where we required some meta data to do
some stuff in the gen. CodeSmith doesn't have a native way to go and grab
a value from an XML file that I could find, but it really didn't matter. I
simply created a code behind file with a wrapper around some XPath, and was
grabbing values in about 15 minutes. Fantastic.
I know CodeSmith is old news to alot of people, but if you haven't given it a
try yet, your only hurting yourself. Think of it as asp.net, but it will
render code instead of html. Very flexible and easy. Thanks Eric for
a fantastic product.
Check out CodeSmith here,
and Eric's blog
here.