How is OracleCommand Execute Reader returning OracleDataReader?

  • Thread starter Thread starter Ashwin K Gudidevuni
  • Start date Start date
A

Ashwin K Gudidevuni

Hi,

I wanted to find out how is class OracleCommand's method ExecuteReader
returning OracleDataReader. Class OracleCommand implements the interface
IDbCommand which has a method ExecuteReader which returns IDataReader, where
as method ExecuteReader in OracleCommand returns OracleDataReader. If
someone can provide me some insight into how is this being done ....

Thank you in advance
Ashwin.
 
The interface member is explicitly implemented and the default method is
"new" and defined in the concrete class. Because another interface method is
explicit by implemented, the interface contract is not broken because the
object can still be treated as IDbCommand and calls to Execute Reader will
go to the explicitly implemented member.

J. Tennyson Einstein
Einstein Technologies
http://www.einsteinware.com
 
Thanks a lot for your response. Can you show So how will it be implemented
in the following case:
interface IReader {
}


interface ICommand {
IReader Read();
}

class DBReader : IReader {
}

class DBCommand : ICommand {
public DBReader Read() {
return null;
}
}

Thank you again.
Ashwin.
 
Back
Top