1

I've got a rowversion column added to my database and I'm trying to get Dapper mapping to populate it properly on my object.

My object has...

public byte[] RowVersion { get; set; }

And I have included the RowVersion column in my query but when I do a Query..

conn.Query<MyObject, AnotherObject, AnAdditionalObject>(...

The MyObject that I get passed to me has a null for the RowVersion property.

If I do a Dapper Query() without any type then the dynamic I get back has the expected RowVersion on it with the correct value.

Has anyone had this working and if so what am I doing wrong?

Ka Res
  • 311
  • 2
  • 3
  • 17
Shane Courtrille
  • 13,960
  • 22
  • 76
  • 113
  • 1
    `rowversion` is an 8-byte number, not a byte array. Try changing the type to `ulong`. And post the query. It's not possible to verify the problem and check what's wrong without it – Panagiotis Kanavos Jan 17 '18 at 17:02
  • @PanagiotisKanavos To be fair, `byte[]` is what you would use for EF. – DavidG Jan 17 '18 at 17:03

1 Answers1

0

I was able to resolve this thanks to the mental knock from Panagiotis Kanavos. I started simplifying my query to be able to post it and realized that I had placed the RowVersion column in the incorrect place of my select statement so it was being sent to AnotherObject instead of MyObject

Thanks for that.

Shane Courtrille
  • 13,960
  • 22
  • 76
  • 113