Code generator (.net)
What exactly are you trying to do? I think it also depends on where you are trying to create the code (model).
The advantage with Codesmith and MyGeneration is that they provide you with several options for generating your code - for example, in MyGeneration, you can write your templates in different languages.
MyGeneration can provide a metamodel of any DB and a lot of built-in generator scripts - so if you want to generate SP the easiest way is to use generators for MyGeneration - you can find generators for CRUD SP right there.It also provides a pretty good editor if you want to change generators.
If you are building a DSL or something like that (I mean the model comes from some other), you might consider using T4. Be that as it may, editing T4 is not the easiest thing I have done because there is no support for T4 editing in Visual Studio. You might consider purchasing the Clarius T4 editor for good editing support.
source to share
As a code generation mechanism, T4 works the same as CodeSmith or MyGeneration. The main advantage is tight integration into Visual Studio; the main disadvantage is the fewer ready-to-use templates.
I personally prefer the T4 editor from Tangible because it works with the T4 Toolbox .
Oleg
source to share
Something that improves your productivity is the built-in Visual Studio snippets .
tab tab
Like typing if
and clicking on the button twice will generate an if statement and then basically you just fill in the spaces
try
and two tabs will generate try-catch block
etc...
There is a whole list of snippets you can use.
source to share
Also, with the T4 templates these days, there is another way to generate code in VS - MVC Scaffolding , which can be used for any code generation (not just ASP.NET MVC).
It is based on T4 but adds some useful features such as template parameters, VS integration (opening documents, etc.), PowerShell scripts, and multiple file generation.
source to share