Strongly typed dataset + Generic provider ?

  • Thread starter Thread starter Rickard
  • Start date Start date
R

Rickard

I have designed some datasets using VS2005 by dragging in tables from a
SQL2000 server.

When I look at the generated code, it references the SqlClient provider
in many places (for example, the command objects and the mappings of
datatypes).

Is there some way to make these generated datasets generic, so they can
take a connection of type IDbConnection?
 
The SQLClient object appear because the wizard knew where you got the schema
from. The concept is the same from SQL to IDB to ODBC and so on.

What I usually do is:
1. Create the datasets along with the tableadapters
2. Stripout the tableadapter information from the desinger
3. Create a new partial class for the dataset
4. Paste in the tableadapter information, change the classes to mustinherit
or abstract
5. Convert SQLClient to IDB.
6. Create derived classes, overriding where I should. Typically, I do
OLEDB for Access and SQLCLient for SQL

Yeah, its work, but it seems way better than doing it all by hand.
 
Back
Top