New Posts New Posts RSS Feed: Datatype Conversion
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Datatype Conversion

 Post Reply Post Reply
Author
SandLink View Drop Down
Newbie
Newbie
Avatar

Joined: 11-Feb-2012
Posts: 1
Post Options Post Options   Quote SandLink Quote  Post ReplyReply Direct Link To This Post Topic: Datatype Conversion
    Posted: 11-Feb-2012 at 10:06am
I have a legacy DB running on Oracle which has a few specific internal data representations which need to be converted into more standard data types in my entities. To whit:
Booleans are represented as 0 or 1, which is a NUMBER1. The designer maps the values as Int16, and throws an exception when I want to use an Boolean.
Empty strings in Oracle are represented as single space strings, while an empty string '' is NULL.
What I need is to be able to convert from the DB representation to a CLR representation in the mapping layer, but I can't find any information as to any available handles for this.
Apart from costly workarounds like duplicating all my properties, are there any elegant solutions to the problem?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 13-Feb-2012 at 8:59am
Hi SandLink,
 
Regarding your NUMBER(1,0) type the only way I could see the 'conversion' is to actually have a custom property (boolean) that would assign/retrieve (i.e. via property interceptor) the proper int value (after all the field is of int type even though it only takes 0s and 1s).
 
As for empty strings, you can set ShouldTreatEmptyStringAsNull to false:
 
myEM.VerifierEngine.DefaultVerifierOptions.ShouldTreatEmptyStringAsNull = false;
 
Regards,
   Silvio.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down