Search code examples
.netcode-generationt4codesmith

Code generator (.net)


Do you have any experience with T4 and T4 Editor? Can you compare it to CodeSmith or MyGeneration?

What code generators do you use? What do you recommend?

I want to use it for generatig of SPs. Is there anything else you find code generation useful?


Solution

  • What exactly you are trying to do? I guess it also depends on from where you are trying to generate the code (the model).

    The advantage with Codesmith and MyGeneration is, they provide multiple options for you to generate your code - for eg, in MyGeneration, you can write your templates in various langs.

    MyGeneration can provide a meta model of any DB and a lot of built in generator scripts - so that if you want to generate SPs, the easiest thing will be to use generators for MyGeneration - you can find generators for CRUD SPs right there. It also provides a reasonably good editor if you want to modify the generators.

    If you are building a DSL or something (I mean, the model is coming from some where else), then you might consider using T4. How ever, T4 editing is not the easiest thing I've done, because there is no T4 editing support with in Visual Studio. You might consider purchasing Clarius T4 editor for good editing support.