Custom DataType Mapping ...

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 1
Joined: Tue 14 Apr 2009 13:09

Custom DataType Mapping ...

Post by DeepDiver » Tue 14 Apr 2009 13:56


I'm currently evaluating dotConnect for Oracle and I have one question:

Is it possible to perform custom data type mapping?

Allow me to give you an example:
There is a column defined as char(1) NOT NULL, which will hold Y or N.
In the Entity Developer this is mapped to System.String.
I want to change the type - well lets call it class YesNo.
To get the correct value written to the database I just override ToString() and return Y or N.
But on reading the data from the database I get an InvalidcastException.
implicit and/or explicit conversion operators from string don't help.

Any idea?

THX alot,


PS: Allow me to congratulate you for this cool product! ;-)

Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 15 Apr 2009 08:49

The simplest way for handling the situation is to implement a new public wrapper property in your class.
Here is an example using the bool wrapper:

Code: Select all

public partial class myEntity {
  public bool MyWrapperProperty{
      //Here is to be the code converting the myColumn value to bool
     //Here is to be the code converting the bool value to myColumn
Of course, you can implement wrapper property of any other type.

Post Reply