wimpleshapers
06-19-2007, 10:29 PM
Using the latest Npgsql Ado driver, I get an exception when performing a query. The error occurs when the function:
AdoTemplate.Execute<T>(ICommandCallback<T> action)
invokes
T result = action.DoInCommand((DbCommand)command);
The error says the cast to 'DbCommand' is illegal. This makes sense, since the Npgsql driver's implementation of the command object simply implements IDbCommand, and does not extend DbCommand. I was able to correct the problem by changing methods in QueryCallback<T> and ICommandCallback<T> accept IDbCommand instead.
Is this the corrrect action to take, or is the Npgsql library expected to implement DbCommand instead.
Thanks.
AdoTemplate.Execute<T>(ICommandCallback<T> action)
invokes
T result = action.DoInCommand((DbCommand)command);
The error says the cast to 'DbCommand' is illegal. This makes sense, since the Npgsql driver's implementation of the command object simply implements IDbCommand, and does not extend DbCommand. I was able to correct the problem by changing methods in QueryCallback<T> and ICommandCallback<T> accept IDbCommand instead.
Is this the corrrect action to take, or is the Npgsql library expected to implement DbCommand instead.
Thanks.