IsRowVersion can only be configured for Byte array properties


I recently upgraded from EntityFramework 5 to 6 via the NuGet updater. Everything seemed to go well and I built and executed my application. When I tried to retrieve the first entity from the database, I received this error:

The property 'UpdatedDate' is not a Byte array. IsRowVersion can only be configured for Byte array properties.

Here is the piece of code it is referring to:

public virtual DateTime UpdatedDate { get; set; }

I tried removing the timestamp attribute, but got the same error regardless. How do I fix this so I can run my application with EF6?

Accepted Answer

Attributes in EF

If you use [TimeStamp] attribute, then the property should be byte[]
This is then mapped to Rowversion in SQL server

If you want some other field type as a concurrency field. The use the attribute [ConcurrencyCheck]

Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why