Multidatabase support

Oct 23, 2009 at 12:56 PM



I am pretty interested in using your library; does your library support other database types ?

At first look it seems that the library supports only SqlServer.




Oct 23, 2009 at 8:21 PM

Thanks for your interest. You are correct that the only database type currently supported in the library is SqlClient. This is not a limitation on the framework. It just happens to be the database I use.

The library is extensible. There is very little code directly related to SqlClient databases. It would not take a lot of work to add support for Odbc, OleDb, and Oracle databases. If you did a copy-and-paste of the SqlOperation, ResultSetSqlOperation, and ResultReader<T> classes (plus tweaked some of the shared code in DatabaseUtility), you could rename the classes and change a dozen or so references to the DbCommand and DbConnection. Then you would be mostly ready to run.

The core features of the framework don't care about the database. Your code would still be able to take full advantage of all these features such as customizable automatic retries, accurate timeouts, efficient parallel execution, and flexible transactions.

Unit testing would be more of a problem because I don't think the support for creating databases on the fly is as seamless as with SqlClient. If you want to go all out with the code, unit tests, and documentation, I can even give you access to check in your work.

I think this is a very good idea. I'm adding features on the Issue Tracker page.



Oct 23, 2009 at 8:35 PM
Edited Oct 24, 2009 at 7:02 AM

I thought of a different approach. I have generalized all the database Operation classes to support all data providers. Now they use IDbCommand, IDbConnection, and IDataReader instead of the SqlClient objects. You can use the OLE DB, ODBC, Oracle, or any other data provider. And the code still takes advantage of the BeginXxxx/EndXxxx methods of SqlCommand for best performance.

This enhancement will be in the next release. But you can use it now if you download the source code and build the Main branch yourself. Let me know what you think.



Oct 24, 2009 at 4:31 PM



thank you very much for the fast reply and for the modification; I am pretty tired in using ORM such as NHibernate; I think that NHibernate is a very good tool, but it's not good for all the projects.