Generation Number Out of Sync

May 6, 2011 at 3:30 PM

I just noticed something odd: the internally-generated generation number (e.g., x in got out of sync. There were generated update scripts with generations beyond what was written into UpdateInstaller.cs.

I fixed the problem by re-generating the schema enough times to catch up. In doing that, the schema generator kept creating new update scripts with increasing generation numbers (i.e., preserving the discrepancy). But since they were empty I just deleted them.

Besides reporting this, I'm also curious if there's a config parameter someplace that I can change to keep the numbers from getting out of sync.

May 6, 2011 at 10:04 PM

There is a ".info" file with the same name as the model. You might have deleted it or not copied it to another machine. That files keeps up with the generation number. Look on your disk now and you will see it. It is just an XML file with a little information in it.

May 6, 2011 at 10:24 PM

I found it, thanks. But while tweaking the GeneratedVersion value fixed the problem regarding in so far as the generated sprocs are concerned, I noticed that the value of _upgradeToVersion in the UpgradeInstaller class is still lagging behind by one increment. Is that field in the generated UpgradeInstaller file controlled from somewhere else?

May 7, 2011 at 12:32 PM

The file is really the next version number. Maybe this is confusing but you really are not supposed to look in the file. Basically after generation the cache file is incremented. The upgrade SQL file and the version generated in code are the same and this is the current version.