Automating Code Generation

Posts   
 
    
dclewis
User
Posts: 14
Joined: 11-Feb-2009
# Posted on: 06-Mar-2009 09:36:20   

Hello,

I have written a blog post on how the development team I am a member of has automated our code generation process using LLBLGen. We use Team Foundation Server for source control and we now have a process by which we can regenerate all of our files and perform other necessary tasks related to the code generation at the click of a button.

I am interested in any feedback that the LLBLGen community can give on how to automate and simplify the code generation process. And I hope that other development teams using LLBLGen and Team Foundation Server will find the information in the post useful.

The post can be found at: http://www.lightspeeditsolutions.co.uk/companyblogs/default/09-03-04/LLBLGen_-_Automating_Code_Generation_with_Team_Foundation_Server.aspx

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 06-Mar-2009 09:39:43   

Thanks for sharing. And I hope you get a positive feedback from the community. Best of luck.

wtijsma
User
Posts: 252
Joined: 18-Apr-2006
# Posted on: 06-Mar-2009 18:40:04   

Hi,

Thanks for the extensive article!

I thought of a similar build process before (well not with the automatic updating of templates and assemblies) but would actually prefer to exclude the generated source files from source control, and only include the LLBLGen project file.

This would allow you can make the code generation actually part of your build process, where the code has to be generated in a pre-build event on both the developer machine as well as the build server.

Advantages are :

  • don't need to check-out/check in the generated source files (as they are not under source control)

  • you never have to worry about whether the lgp file is in sync with the generated files I think this scenario would become more useful in when the LLBLGen projects can be saved as source-control friendly text files.

Just my 2cts simple_smile

Wiebe

dclewis
User
Posts: 14
Joined: 11-Feb-2009
# Posted on: 09-Mar-2009 09:51:40   

Hi wtijsma thanks for the feedback.

In the team that I am a member of we make use of user code regions in our templates. This means that we don't have much of a choice but to check in all of the generated code in to source control. Otherwise it would make a lot of sense just to leave all of the code out of source control just like you suggested.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 24-Mar-2009 20:52:28   

The solution to this is to use Partial Classes rather than the included code regions. In this case just you custom partial classes need to be kept in source control - the generated code can be regenerated on the fly as needed.

Matt

dclewis
User
Posts: 14
Joined: 11-Feb-2009
# Posted on: 25-Mar-2009 17:00:51   

MTrinder wrote:

The solution to this is to use Partial Classes rather than the included code regions. In this case just you custom partial classes need to be kept in source control - the generated code can be regenerated on the fly as needed.

Matt

Hello MTrinder,

We also generate content for aspx pages and ascx files. It is in these that we have user code regions. We do use partial classes for any code files that we create when customisations need to be made. I suppose that there is some potential for leaving some of the code out of source control that we generate, but we do have a system that works now and we are all quite happy with it.