DeletebyId doesn't accept RowVersion as byte[]

Hi

I am having trouble sending RowVersion as byte[] in deletebyId method in OrmLite

I am using latest version of OrmLite

Right, it only accepts the default ulong RowVersion. You can use OrmLiteUtils.ConvertToULong() to convert a byte[] RowVersion to ulong.

If I do that then I get the following error
Database: MSSQL 2014
I am using Ormlite 2014 Dialect

this is my database RowVersion type

That’s what OrmLite uses to convert RowVersion byte[] to ulong internally.

Why are you using byte[] instead of ulong? Where did you get the byte[] value from?

I tried using ulong all along and I have no problem using it, but I get same error as on the picture.
Updates works no problem.
RowVersion variables comes from database when i do select.
Here is my model

Ok so if you don’t need to use byte[] RowVersion use ulong:

public ulong RowVersion { get; set; }

You don’t need the [RowVersion] attribute, the ulong RowVersion definition infers its for RowVersion.

I have switched byte[] to ulong and please see below same error

I have change my model as following
exactly the same error

This issue should be now be resolved from this commit.

This change is available from v5.1.1 that’s now available on MyGet.

FYI, you can also combine multiple attributes in c# with:

[IgnoreOnInsert, IgnoreOnUpdate]
pubic string CategoryPath { get; set; }
1 Like

Thank you so much for your help!

1 Like