I have a simple console app using SQL Compact 4.0 and entity frameworks 4. The database has a single table called Section
which has three columns: Id
(StoreGeneratedPattern: Identity, Type: Int32), Title
(Type: string) and TimeStamp
(StoreGeneratedPattern: Computed, ConcurrencyMode: Fixed, Type: Binary, MaxLength: 8). The TimeStamp column is actually a rowversion type in SQL Compact.
I have the following code in main:
Section section = new Section();
section.Title = "Hello";
using (Entities1 context = new Entities1())
{
context.Sections.AddObject(section);
context.SaveChanges();
section.Title = "Changed";
context.SaveChanges();
}
This code throws a concurrency exception because the TimeStamp column is not getting updated from the database after the first SaveChanges() method. Note that it works fine in SQLServer2008.
Is this a bug in Compact or am I missing something?
Thanks,
Darren