Pomelo.EntityFrameworkCore.MySql icon indicating copy to clipboard operation
Pomelo.EntityFrameworkCore.MySql copied to clipboard

Does [Timestamp] attribute used to manage concurrency work in this provider?

Open nicholasyin opened this issue 3 years ago • 3 comments

If it does, is it working the same way as in SQL Server? Any extra code required?

nicholasyin avatar Aug 09 '22 05:08 nicholasyin

Turns out not supported. Got this error:

Field 'RowVersion' doesn't have a default value.

nicholasyin avatar Aug 10 '22 03:08 nicholasyin

Try the following:

[Required]
[Timestamp]
public byte[] RowVersion { get; set; }

mguinness avatar Aug 10 '22 17:08 mguinness

Try the following:

[Required]
[Timestamp]
public byte[] RowVersion { get; set; }

Great! It worked, even without the [Required] attribute. The only thing noticeable is that the database column type was mapped as timestamp(6), even though the model says byte[]. What's even more interesting is a sql select statement returns the result as a date time value but retrieving the same record using the entity framework model assigns byte[] value also correctly. Don't know what happened behind the scene, and don't know what the byte[] value is as it can't be decyphered.

nicholasyin avatar Aug 11 '22 08:08 nicholasyin