views:

218

answers:

1

I have been experimenting with GenWise and CodeSmith. I am looking for a tool that will:

a) let me edit the data schema in SQL Server SSMS

b) generate all the C# objects, xml etc from the database

c) have lots of control over the genrated XML and C#

d) do the "right thing" when generating code so that I can use the tool iteratively. ie round trip code generation, not just generate once or twice and then give up when I have to make manual changes.

e) I DON'T want a solution that goes backward: write C# with annotations and generate the DB schema. That IMO sucks and screws you when you need to fine tune the schema. DB code should be driven from the DB schema upwards, not code downwards.

I have to say, it appears the GenWise does all of this. Has anyone used it for an extended period of time involving iterating changes in the DB schema and regenerating code, while also customizing the business objects/logic in the code?

A: 

I have used template based tools like CodeSmith or MyGeneration and I have also used tools, like LLBGen which I think is similar to GenWise althought I never used this one myself.

Personally I prefer template based tools. IMHO they give you a lot more control and the possibility to fine tune your generated code. With tools like LLBgen my experience is a bit more limited, but I didn't like the fact that I didn't understand all generated code before I hit generate. Tools like LLBGen will get the job done faster, but if you’re a control freak and you want to know what the generated code does then you’ll need to go through all generated code and understand how it works.

Btw I’ve moved from this approach to domain driven design a few years ago, but in a few cases I still find that generating code from the DB is a better solution.

Pedro Santos