Hi,
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,
Tom
PS: Allow me to congratulate you for this cool product!
Custom DataType Mapping ...
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:
Of course, you can implement wrapper property of any other type.
Here is an example using the bool wrapper:
Code: Select all
public partial class myEntity {
public bool MyWrapperProperty{
get{
//Here is to be the code converting the myColumn value to bool
}
set{
//Here is to be the code converting the bool value to myColumn
}
}
}