0

Is there a way to specify unsigned integers in the OData Metadata (CSDL) format? I have a data structure that contains an unsigned 64 bit integer, but from the documentation here it seems there isn't a choice for unsigned integers?

What are my options? Use the string version of the 64 bit number, or use the Edm.Binary type to specify the hex representation? Is there a better way?

jonathan_ou
  • 756
  • 1
  • 7
  • 17
  • Can't you just map your unsigned bigint properties to regular bigint? – Roy Dictus Jul 13 '11 at 10:20
  • I guess you could, but then when interpreting them it may cause confusion. Let's say the property was meant to hold the size of something, if the number is big enough that it takes more than 32 bits to represent, you go read the size property and suddenly get a negative number, what would that mean? You'd have to do some manual conversion to get back the original unsigned size. It'll work, but it's ugly. I don't understand why OData wouldn't include unsigned types, they have one for unsigned bytes, why not integers? – jonathan_ou Jul 14 '11 at 06:44
  • With "map", I don't mean bitwise, I meant "convert". Are you actually going to need unsigned 64-bit integers? Is this for an astronomy application that must count the inches between planets? – Roy Dictus Jul 14 '11 at 07:36
  • It's for an ID number that relies on the 64 bit property for uniqueness. Having negative ID numbers normally doesn't make sense, but I guess could be done if we don't have unsigned integers in OData. – jonathan_ou Jul 18 '11 at 06:23
  • In that case I suppose a string could be your best option. It's readable and sortable and you don't have to use negative numbers, but it's slower than a number of course. – Roy Dictus Jul 18 '11 at 06:27

0 Answers0