Background: I use a class System.Data.Common.DBConnectto set classes that connect to various types of data sources, such as CSV, AD, SharePoint, SQL, Excel, SQL, etc. There is an interface that defines a contract for all types of data sources.
I wanted to use the connectionString property of a DBConnection object to store file paths in file sources to jump to methods GetData(DBConnection conn)for file-based file data sources. This does not work because when you assign a string, the ConnectionStribg property is created. My question is: How to create my own class derived from the DBConnection class (this is an abstract class) that ONLY ANNOUNCES a single ParameterString property?
TL; DR; I want to inherit from System.Data.Common.DBConnectand add my own string property. How?
EDIT
The interface is as follows:
public interface IDataImport
{
DbConnection CreateDbConnection(params string[] connectionString);
DataSet GetResults(DbConnection conn, params string[] strQuery);
DataTable GetAvailableTables(DbConnection conn);
DataTable GetAvailableFields(DbConnection conn, string tableName);
}
source
share