Add t4 templates to generate constructor classes; minor refactor.