What an application do in a computer? It plays with data, data & data using logic. And databases are versatile storage for the data. Application talks to the database to get the desired data quickly. One application can talk to Oracle database, another may talk to MySQL. The communication system between these db is db specific.
These leads us to a common question, isn't it possible to implement an architecture which can talk to any db with minimum implementation & logic level transparency? It was possible via JDBC. Now it is possible through C#/VB using .Net framework. ADO.NET is the Microsoft's implementation similar to JDBC, but with some great features. The main backbone of ADO.NET is the DataSet, DataTable & DataAdapter. ADO.NET architecture looks like this -
As you can see that the Data Provider provides database specific implementation. DataSet & DataTable grants the application a transparent view of the database.
Data Provider consist of Connection, Command & DataReader. IdbConnection, IdbCommand & IdbDataReader provides interfaces to implement database specific Connection, Command & DataReader. The Connection is responsible for connecting to the specific db. Command takes the query to execute against an open Connection & sets up the parameter of the query. DataReader is responsible to read the returned value from the database after executing the Command.
Now DataSet, DataTable & DataAdapter comes into play. DataAdapter is a provider which can create DataSet on the fly. It uses database specific Connection & Command to execute a query against the database and creates the transparent database DataSet on the fly. DataSet can hold many DataTable. These DataTables are the logical representation of database tables. After creating the DataSet, application use the DataSet as the database itself. Thus ADO.NET provides the logic level transparency.
DataSet is also used for RAD. If you know what will be the content of a DataTable inside a DataSet you can design that DataTable graphically and the attach it to a controller. This way you create a forward declaration to your DataTable content & can leverage that information to build application more quickly.
Another great power of ADO.NET is the XML / LINQ. You can use XML input as database.
Hope this article gives you an overview on ADO.NET architecture. If you have any query or suggestion please fill free to leave a comment. Next time I will try to give demonstrate a sample program using ADO.NET.
Till then, goodbye. :)
No comments:
Post a Comment