The Infoset and Int16s

Topics: Core
Dec 10, 2014 at 11:56 PM
Today I tried using the "new" Store method on my ContentPart with a short type. It fails because the Orchard.ContentManagement.XmlHelper ToString<T>(T value) method does not support shorts.

Is this by design? Do we not care about shorts anymore?
Coordinator
Dec 15, 2014 at 8:37 PM
mm, I think a more relevant question would be: why do you need a short? Especially if you're going to store it into the Infoset.
Dec 17, 2014 at 5:13 PM
Well, it's not "needed". I can just use an int32 which works fine. It's just a common practice of mine to store my enums as shorts. I certainly don't need 32-bits for an enum that will probably never have more than 5 values.

In this particular scenario I am storing the enum value in the PartRecord, so that I can query against it, but also in the infoset for when I do not need to query against the PartRecord.

I guess the difference between an int16 and int32 as far as memory usage and db storage goes is negligible.