1

I am working on a legacy web app which implements model first(edmx file) approach using Entity Framework.

I need to implement optimistic concurrency, so I have added this field as following:

enter image description here

and inside the database has been created as binary(8) type. But when I try to update the entity is getting updated but the VersionRow values is not updated(no new value generated).

P.S

When I added the column I have binded default value as 0x0000000000000000 because it does not allow null values.

Simple Code
  • 2,354
  • 2
  • 27
  • 56

1 Answers1

2

Yea I solved it this way:

1) I changed the type of RowVersion column from Binary(10) into timestamp inside SqlServer.

2) In the property details inside the .edmx file I have put the property StoreGeneratedPattern of the property RowVersion as Computed.

Computed it means that a new value is generated on insert and update.

Now it became as following:

enter image description here

Simple Code
  • 2,354
  • 2
  • 27
  • 56