Source Control Question--Modifying Templates

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 19-Jul-2010 15:21:03   

I am about to start digging into customizing some of the code generation templates for the first time (having used the product for about 6 years simple_smile ).

Should I make a copy of all existing templates and keep them in a local folder that is kept under source control?

In general, what are some best practices for keeping modifications to code generation templates under source control?

Thanks,

Phil

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 19-Jul-2010 15:43:07   

It's recommended that you leave the defacto templates unchanged. Just take a copy of the templates and templateSets you want to change, put these in a separate folder, and keep them under source control.

You should set the Project Property "Additional Templates Folder" to the folder holding the templates.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Jul-2010 12:13:38   

Also, you can 'override' templateID bindings with your own templateid bindings in a separate template binding file, which you then place above the ones which you want to override on tab 2 of the code generator configuration dialog.

This means you can create new templatebindings files and just bind the templates (copies of originals) which you want to modify.

If you want to add template code, look into using include templates. In general you just need to add templates, never alter ones.

Also, check whether you can avoid generating new code at all by creating partial classes of for example CommonEntityBase or DataAccessAdapter for example.

Frans Bouma | Lead developer LLBLGen Pro