Page 1 of 1

request: improve integration with version-control systems

Posted: Thu 26 Jan 2012 16:31
by mindplay
The code-generator currently places a date/time stamp in the header of each generated source-code file:

Code: Select all

//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using NHibernate template.
// Code is generated on: 1/25/2012 12:30:36 PM
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------
The problem with that, is that the line with the date/time-stamp in it, will register as a change - or in other words, anytime you regenerate your model, every generated file is going to register as a source-code change.

This makes it hard to look at a revision in source-control and understand what actually changed.

I added the following near the top of my template:
I changed the GenerateFileHeader() method as follows:

Code: Select all

//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using NHibernate template.
// 
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------
Now select your template in the Model Explorer panel - on the property sheet, you will see the new "Version Control Tag" input, which I personally set (for Subversion) as:

Code: Select all

$Id: id $
After adding the svn:keywords=Id property to the folder, and doing a commit to Subversion, the file has the revision Id in it:

Code: Select all

//------------------------------------------------------------------------------
// This is auto-generated code.
//------------------------------------------------------------------------------
// This code was generated by Entity Developer tool using NHibernate template.
// $Id: Category.Generated.cs 1428 2012-01-26 16:19:12Z rschultz $
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//------------------------------------------------------------------------------
After rebuilding the model, of course this line will be wiped out again, so this solution isn't perfect.

But after a rebuild, unless this file has actually changed in some other way, the updated header will not register as a change - so you get clean source-code updates, without having to manually review and revert meaningless changes to your entire model.

I would recommend integrating this (or something similar) in the standard ED templates.

Posted: Fri 27 Jan 2012 11:04
by Shalex
Thank you for your suggestion. We will post here when the change is implemented in the standard ED templates.

Posted: Mon 27 Feb 2012 11:12
by Shalex
The "HeaderTimestampVersionControlTag" generation template option is added for improving integration with version-control systems. We will post here when the corresponding build of Entity Developer is available for download.

Posted: Fri 16 Mar 2012 17:30
by Shalex
New version of Entity Developer 4.3 is released!
It can be downloaded from http://www.devart.com/entitydeveloper/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=23647 .