views:

22

answers:

1

Hello,

I want to generate a typed DataSet for both Oracle and DB2 databases from a single XSD file.

Background: When I drag a table onto the Visual Studio Dataset Designer, it generates a XSD file (e.g. DataSet1.xsd) with all appropriate information. Then VS invokes the built-in Tool (MSDataSetGenerator) to generate the Dataset classes into the CS file. Somehow (I don't know how) CS determines the Data provider and generates Dataset classes that refer to the data provider (OracleDataProvider or IBM.Data.Provider).

Question: Does anybody know how I can customize VS to compile both for DB2 and Oracle code generation ?

Best regards Oliver

A: 

Hi the problem is not in the structure of the data (set,tables).
It's the automatically generated adapters that create a dependency on the database/connection.

The first way to circumvent this (a bit) is using ODBC connections for your adapters.
Then the connectionstring determines which database you use..
However.. the SQL syntax is always a little different.


Personally I just make a DataSet.xsd with only datatables (new datatable instead of new dataadapter).

Then I write my own repositories/adapters myself. So one for oracle and one for DB2.
These repositories/adapters fill the datatables..

So you can share the model between databases but you implement database specific adapters.

Julian de Wit