Implementing a Generic Data Access Layer in ADO.NET Part 1
The corresponding interfaces that the above classes implement are stated below.
The Data Providers that make up the library are specific to a particular database that they would connect to. These are the Data Providers that are available in ADO.NET.
SQL Server Data Provider
Oracle Data Provider
ODBC Data Provider
OleDB Data Provider
Now we are all set to implement our DAL. The major components that constitute our DAL block are:
We will start our discussion with the enum data type that would contain the data provider types in it. These provider types relate to the databases that we will be connecting to, depending our requirements. The following code snippet illustrates the ProviderType enum that contains four values that correspond to a specific data provider.
public enum ProviderType
SqlServer, OleDb, Oracle, ODBC, ConfigDefined
Now, there may be situations where you might need to either keep the database connection state open or close after a database operation is over. As an example, after you read data into a DataReader instance from the underlying database, you might need to keep the connection state open for subsequent operations. You may also need to close it if it is no longer used. Keeping this in mind, let us have an enum data type that houses two values that correspond to the database connection states that we just discussed about. The following is the code for the enum called DatabaseConnectionState.
public enum DatabaseConnectionState