Generate All The Things
or how to save yourself some work in the long run
Coding is a lot of work, and sometimes it gets repetitive too. I don’t like repetitive work so most of my projects grow some kind of code generator. Usually it starts with a unit test that outputs a simple class definition, and before you know it, it generates a complete data-access layer with NHibernate mappings in FluentNHibernate that generate SQL create scripts… but that’s a story for another post. So, here’s my default ‘plan’ for building ad-hoc code generators: Create a test project Add a InternalsVisibleTo attribute to the target project with the assembly name of the test project, so that the test project can access methods and properties defined as internal in the target project.
[Read More]