What would be the most efficient data type to store a UUID/GUID in databases that do not have a native UUID/GUID data type? 2 BIGINTs?
And what would be the most efficient code (C# preferred) to convert to and from a GUID to that type?
Thanks.
It's hard to say what would be the most efficient without knowing the database you are using.
My first inclination would be to use a binary(16)
column.
As for using that value in C#, the System.Guid
type has a constructor that accepts a byte[]
array, and a method ToByteArray()
that returns a byte array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With