- New file: Generate its own, new, separate file. This is the most basic way. You could then integrate it into your other files:
- (C#) Base Class - For an OOP language like C#, you could code-generate the base class, and then have your derived classes inherit it.
- (C#) Partial classes - Starting with .Net 2.0, C# offered partial classes which let you split the class definition across multiple physical files.
- Existing file: Merge into existing file with custom regions. For example, CodeSmith offers two kinds of custom regions:
- InsertRegion - Insert your generated code into a marked region of a custom file
- PreserveRegion - Insert your custom code into a code-generated file.
You could also integrate CodeSmith into your builds and processes by calling the CodeSmith console app.