I am seeing the exact same behavior. I have worked on this all afternoon and the only thing that I was able to get to work was to implement the solution at this link:
http://www.undisciplinedbytes.com/2012/03/creating-a-timestamp-column-with-entity-framework/
Here are the steps copied from the link:
Timestamp column with model-first approach
Now, setting this column with the model-first approach is a little bit trickier. There’s no built-in support for this in EF’s model itself (yet), so we’ll have to hack the code generation template to fulfill our needs.
What we need to do to set up a timestamp column using model first approach is the following:
- Add a property named “Timestamp” to the entity in EF’s model
- Set the type to binary
- Set nullable to false
- Set StoreGeneratedPattern to Computed
- Set ConcurrencyMode to Fixed
- Create a copy of SSDLToSQL10.tt (typically found in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen)
- Edit the line that says:
[<#=Id(prop.Name)#>] <#=prop.ToStoreType()#> <#=WriteIdentity(prop, targetVersion)#> <#=WriteNullable(prop.Nullable)#><#=(p < entitySet.ElementType.Properties.Count - 1) ? "," : ""#>
Change it to:
[<#=Id(prop.Name)#>] <#if (string.Compare(prop.Name,"TimeStamp",true) == 0) { #>TIMESTAMP<# } else { #><#=prop.ToStoreType()#><# } #> <#=WriteIdentity(prop, targetVersion)#> <#=WriteNullable(prop.Nullable)#><#=(p < entitySet.ElementType.Properties.Count - 1) ? "," : ""#>
This will change any column that is called “Timestamp” (case insensitive) to be a Timestamp column.
- Click on the entity canvas and set the DDL Generation Template to this new copy of the file
- Click on Generate Database From Model
10.Enjoy your new concurrency-aware data access!