Enumerated type a character limitation


I have a legacy DB and I want the application to use Aurelius on it, but I have a problem.

There is a field in the DB table that is char(1) and can have values "0" (zero), "+","-". The classes are already defined in the old version of the App (before Aurelius), so I wouldn't like to change the classes if possible.

I try to use this mapping

  [Enumeration(TEnumMappingType.emChar, '0,+,-')]
  TDocStockInfluence = (dsiNoInfluence, dsiIncrease, dsiDecrease);

myclass = class
    FStockInfluence: TDocStockInfluence;

But in run-time i get the error Enum mapped value "0" is invalid for type "emChar", I suppose the problem will be also for "+" and "-" character..?

Is possible to alter the enum to accept and character? I would suggest to allow any character to be used.

Why is zero not allowed? It's treated like a character, not a number in the application. Since there are around 200 databases, is very important to achive the goal without DB or class changes for compatibility with the old application.

1 Like

You can simply use emString instead of emChar and everything will work the same.

Ops, I haven't even seen the option. Sorry, my mistake.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.