Quantcast
Channel: User Simon_Weaver - Stack Overflow
Viewing all articles
Browse latest Browse all 116

Answer by Simon_Weaver for rowVersion gets mapped to byte[8] in Entityframe work but when manually casting it's byte[18]

$
0
0

In the debug logs EF Core shows timestamps in the same format that they appear in SQL Server Management Studio. I needed to be able to convert the byte[8] for timestamp / rowversion to the same format for comparison.

eg. optimistic concurrency checks you'll see parameters like this.

@p3='0x0000000005B7566B'

After a lot of poking around in the source code for EF Core and not finding where they do it I eventually found this very simple way:

Convert.ToHexString(order.RowVersion)// gives 8 bytesConvert.FromHexString("0000000005B7566B")  // don't include the 0x

PS. I never really understood these "AAAxxx==" timestamps. How is that a helpful format for anyone?


Viewing all articles
Browse latest Browse all 116

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>