I am trying to convert my code from straight ADO.NET to the Enterprise
Library 3.1 Data Access App Block. It's mostly straightforward, but I ran
into a problem with datareaders. The OracleDatabase.ExecuteReader method only
returns an IDataReader object, which is mostly okay, except that IDataReader
does not implement HasRows. I hoped that I could get past that by casting the
IDataReader to an OracleDataReader, but when I try that, I get an
InvalidCastException (Unable to cast object of type
'Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDataReaderWrapper'
to type 'System.Data.OracleClient.OracleDataReader'). Is this a bug in the
Enterprise Library, because this behavior doesn't appear to make sense. I
believe I read that this cast works for the SqlDataReader, but I haven't
tried that yet. Any ideas?