M
Mike
Hi,
I am trying to design a generic data access layer that can connect to
multiple data sources (MS SQL, Access...). I have come across some issues.
I have looked at Microsoft's Data Access Layer and have noticed it made all
the methods static. Is this a good idea? In my layer I have an interface
that each of my data helper classes implement with these signatures:
IDataReader ExecuteReader(string connString, CommandType commandType,
string commandText, params IDbDataParameter[] commandParameters);
object ExecuteScalar(string connString, CommandType commandType,
string commandText, string[] tableNames, params IDbDataParameter[]
commandParameters);
void FillDataSet(string connString, DataSet dataSet, string sql);
DataSet ExecuteDataset(string connString, CommandType commandType,
string commandText, string[] tableNames, params IDbDataParameter []
commandParameters);
and so on...
I am trying to decide is it really worth designing a layer that can handle
different data sources. I pass enum type to my data access layer and it
creates the correct data components and in each method signature I pass the
correct connection string. I am just wondering what others are doing.
Thanks
I am trying to design a generic data access layer that can connect to
multiple data sources (MS SQL, Access...). I have come across some issues.
I have looked at Microsoft's Data Access Layer and have noticed it made all
the methods static. Is this a good idea? In my layer I have an interface
that each of my data helper classes implement with these signatures:
IDataReader ExecuteReader(string connString, CommandType commandType,
string commandText, params IDbDataParameter[] commandParameters);
object ExecuteScalar(string connString, CommandType commandType,
string commandText, string[] tableNames, params IDbDataParameter[]
commandParameters);
void FillDataSet(string connString, DataSet dataSet, string sql);
DataSet ExecuteDataset(string connString, CommandType commandType,
string commandText, string[] tableNames, params IDbDataParameter []
commandParameters);
and so on...
I am trying to decide is it really worth designing a layer that can handle
different data sources. I pass enum type to my data access layer and it
creates the correct data components and in each method signature I pass the
correct connection string. I am just wondering what others are doing.
Thanks