Once you have decided to use a generative approach in your development effort, it is a good idea to apply some architectural guidelines as to how to use it:
In general, you should try to meet the goal that all of the generated code must be at least as good as if it had been written manually. While not always possible, the idea of this goal is to avoid using code generation to circumvent problems with the underlying architecture and frameworks.
While code generation can sometimes improve performance, you need to be careful to avoid the dreaded “code bloat” symptom. Since generating code is so easy, you might find yourself with a million lines of code, where a lot of them are basically just identical, with only minor changes. Your underlying platform will often allow you to solve these problems by building libraries or frameworks. Use this approach, and augment it with code generation where your platform does not provide the needed means.