시스템을위한 간단한 데이터베이스 프로세서를 개발 중이지만 2 개의 데이터베이스, PostgreSQL 및 Oracle (XXg)을 지원해야합니다..NET의 불가지론적인 연결 처리기
예는 IDataReader에, IDbConnection을 같이 만 System.Data 인터페이스를 사용하여 이러한 두 개의 데이터베이스를 처리하는 클래스를 구축 할 수 있다면 궁금
... bunch of properties, constructors and fields
private String BuildConnectionString();
public Int32 ExecuteNonQuery(NpgsqlCommand sqlCommand);
public NpgsqlDataReader ExecuteQueryReader(NpgsqlCommand sqlCommand);
public Object ExecuteScalar(NpgsqlCommand sqlCommand);
(이미 pgSQL의 근무) 같은 것 , 등등. 나는 그것이라고 생각하지만, 내가 인스턴스 연결이 필요할 때 좀 붙어 있습니다. 예 :
이들은 간단한 데이터베이스 요청입니다이 작업을 수행하는 빠른 방법이 있나요
public AgnosticConnectionHandler(String userName, String password,
String database, String server, Int32 port)
{
this._userName = userName;
this._password = password;
this._database = database;
this._server = server;
this._port = port;
this._connection = ????
}
: 다른 경우
public PgSqlConnectionHandler(String username, String password,
String database, String server, Int32 port)
{
this._username = username;
this._password = password;
this._database = database;
this._server = server;
this._port = port;
this._connection = new NpgsqlConnection(BuildConnectionString());
}
, 난 _connection이 (IDbConnection을) 대해서 typeof입니다 (것 나는 아무것도 좋아할 필요가 없다. 작은 시스템이다.
고맙습니다. 도와 주신 모든 분들께 감사드립니다.) –