views:

9

answers:

0

Quick summary: When using the TableAdapter Configuration Wizard for typed datasets, the wizard does some implicit mapping from Oracle datatypes to .NET datatypes. Does anyone know how I can access & modify that mapping logic?

In more detail: I often create strongly-typed datasets against an Oracle database (using either the "Oracle Data Provider for .NET" or the ".NET Framework Data Provider for Oracle"... does not matter, same problem for both). I use the wonderful TableAdapter Configuration Wizard to add tables, create parameterized SELECT queries... all that is lovely.

My problem is that I would like to have some control over how the wizard maps the Oracle database datatypes to the resulting DataColumn DataType's (the .NET datatype). Specifically, for example, I would love to impose a rule that if the Oracle datatype is NUMBER(1,0), that the resulting DataColumn object would have a DataType=System.Boolean. (I would similarly like to map some other Oracle types to specific .NET datatypes).

I can set the DataType of the columns manually after finishing the wizard to what I want, and then everything in my code works fine (e.g. the NUMBER(1,0) fields do function perfectly as Boolean values, without any type casting required, even for updates & inserts!). However the problem comes when I go back to use the TableAdapter wizard again, to modify something, add a new column, etc. --- any field for which I have manually modified the default DataType it essentially considers to be a manually-added field in the DataTable object, and therefore adds a second copy of the field in the resulting table, with the DataType that it thinks is correct. Then I have to manually remove the duplicated field, reset the Source property on my manually-edited field, etc etc. It becomes quite tedious on tables with a lot of fields like this.

This is a problem that has bothered me for a long time.