IDbCommand implemented (good), but MySqlCommand should inherit from System.Data.DbCommand
Posted by: Kenneth Brady
Date: December 21, 2006 05:33AM

I have a set of applications which work in a database-agnostic fashion using the interfaces IDbConnection, IDbCommand, IDbDataAdapter, etc.

Using MySqlCommand via the IDbCommand interface, I get an invalid cast exception (unable to cast to DbCommand) when I try to "select [field list] from [table]".

It seems an error on Microsoft's part that implementing the interfaces should be insufficent to work in their framework. Nevertheless, MySqlCommand can be coded more efficiently by re-using DbCommand.

There are equivalent abstract classes for the other interfaces - DbConnection, DbParameter, DbParameterCollection, DbDataAdapter, etc. These base classes already implement the related interfaces.

ken brady

Options: ReplyQuote


Subject
Written By
Posted
IDbCommand implemented (good), but MySqlCommand should inherit from System.Data.DbCommand
December 21, 2006 05:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.