request: improve integration with version-control systems
Posted: Thu 26 Jan 2012 16:31
The code-generator currently places a date/time stamp in the header of each generated source-code file:
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:
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:
After adding the svn:keywords=Id property to the folder, and doing a commit to Subversion, the file has the revision Id in it:
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.
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.
//------------------------------------------------------------------------------
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:
Code: Select all
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.
//------------------------------------------------------------------------------
Code: Select all
$Id: id $
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.
//------------------------------------------------------------------------------
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.