F
Frank Rizzo
Ok, ado.net is great, yada, yada, yada.
However, I normally write code generators that are then used by other
people in the company. These generators are used, among other things,
to gen DB related code (stored proc wrappers, etc...). The database
servers are quite diverse (ms sql, sybase, etc...).
With VB6 it was easy to write generic code that could handle all the
databases, because Connection, Recordset, Command objects worked for all
databases. The only thing needed was to change the Provider value in
the ConnectionString.
In ADO.NET I can use the OleDbClient namespace but I won't because the
native ones are faster and I won't make my users suffer because it is
more convinient for me to use OleDbClient.
So has anyone been able to write generic code with the native providers
(SqlClient, SybaseClient, OracleClient, etc...) that works with all of them?
I've mostly resolved the problem with the connections. I wrote a class
that figures out which connection I want (sqlclient or sybaseclient or
....), and them simply return a connection object based on IDBConnection
interface.
Connections are easy, because you only need to connect and that's pretty
much it. Has anyone dealt with any other objects (command, dataset,
datareader, etc...) in a generic manner?
However, I normally write code generators that are then used by other
people in the company. These generators are used, among other things,
to gen DB related code (stored proc wrappers, etc...). The database
servers are quite diverse (ms sql, sybase, etc...).
With VB6 it was easy to write generic code that could handle all the
databases, because Connection, Recordset, Command objects worked for all
databases. The only thing needed was to change the Provider value in
the ConnectionString.
In ADO.NET I can use the OleDbClient namespace but I won't because the
native ones are faster and I won't make my users suffer because it is
more convinient for me to use OleDbClient.
So has anyone been able to write generic code with the native providers
(SqlClient, SybaseClient, OracleClient, etc...) that works with all of them?
I've mostly resolved the problem with the connections. I wrote a class
that figures out which connection I want (sqlclient or sybaseclient or
....), and them simply return a connection object based on IDBConnection
interface.
Connections are easy, because you only need to connect and that's pretty
much it. Has anyone dealt with any other objects (command, dataset,
datareader, etc...) in a generic manner?