I did an attempt of resuming the project hbm2net, creating a Text Template Transformation Toolkit (T4) renderer, hosting the T4 engine. T4 templates allow to easily mix templates with additional code.The current version is not production code, but a proof-of-concept. If anyone interested a download is provided, containing the source and a single unit test to show the idea. A ready to use binary version could be found here (post is in italian, but is easy to grasp how to try it),as I said, it is not tested for production. Please let me know if the idea is useful / interesting.