Users Online

· Guests Online: 22

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

Articles Hierarchy

ADO.NET Architecture

ADO.NET Architecture

In this article, I am going to discuss ADO.NET Architecture. Please read our previous article where we discussed ADO.NET Connection Pooling with Examples.

 

What is ADO.NET?

ADO stands for Active Data Objects. ADO.NET is one of Microsoft’s Data Access Technologies using which we can communicate with different data sources. It is a part of the .NET Framework which is used to establish a connection between the .NET Application and different data sources. 

 

So, ADO.NET is nothing but a component in .NET Framework that helps us to fetch data from different data sources to our C#.NET or VB.NET Applications as well as also used to send data from our C#.NET or VB.NET Application to different data sources such as SQL Server, Oracle, MySQL, XML, etc.

 

ADO.NET Architecture

The Architecture of ADO.NET:

The ADO.NET Architecture is comprised of 6 important components. They are as follows:

  1. Connection
  2. Command
  3. DataReader
  4. DataAdapter
  5. DataSet
  6. DataView

From the above components, two components are compulsory. One is the command object and the other one is the connection object. Irrespective of the operations like Insert, Update, Delete and Select, the command and connection object you always need. For a better understanding, please have a look at the following image.

 

The architecture of ADO.NET:

Let us understand each of the components in detail.

Connection:

The first important component of ADO.NET Architecture is the Connection Object. The Connection Object is required to connect with your backend database which can be SQL Server, Oracle, MySQL, etc. To create a connection object, you need at least two things. The first one is where is your database located i.e. the Machine name or IP Address or someplace where your database is located. And the second thing is the security credentials i.e. whether it is a Windows authentication or SQL Authentication i.e. user name and password-based authentication. So, the first is to create the connection object and the connection object is required to connect the front-end application with the backend data source.

Command:

The Second important component of ADO.NET Architecture is the Command Object. When we talk about databases like SQL Server, Oracle, MySQL, etc., we know one thing, these databases only understand SQL. The Command Object is the component where you go and write your SQL queries. Later you take the command object and execute it over the connection. That means using the command object, you can fetch data or send data to the database i.e. performing the Database CRUD Operations.

Note: From the Command Object onwards, you can go in two different ways. One is you can go with the DataSet way and the other is, you can go with the DataReader way. Which way you need to choose, basically will depend on the situation.

DataReader:

DataReader is a read-only connection-oriented recordset that helps us to read the records only in the forward mode. Here, you need to understand three things i.e. read-only, connection-oriented, and forward mode. Read-Only means using DataReader, we cannot Insert, Update, and Delete the data. Connection-Oriented means, it always requires an active and open connection to fetch the data. Forward mode means you can always read the next record, there is no way that you can read the previous record.

DataSet:

It is a Disconnected record set that can be browsed in both i.e. forward and backward mode. It is not read-only i.e. you can update the data present in the data set. Actually, DataSet is a collection of DataTables that holds the data and we can add, update, and delete data in a data table. DataSet gets filled by somebody called DataAdapter.

DataAdapter:

The DataAdapter is one of the Components of ADO.NET which acts as a bridge between the command object and the dataset. What the DataAdapter does is, it takes the data from the command object and fills the data set.

DataView Class

The DataView class enables us to create different views of the data stored in a DataTable. This is most often used in data-binding applications. Using a DataView, we can expose the data in a table with different sort orders, and you can filter the data by row state or based on a filter expression.

In the next article, I am going to discuss How to Perform BULK INSERT and UPDATE in C# with Examples. Here, in this article, I try to explain ADO.NET Architecture and I hope you enjoy this ADO.NET Architecture article.

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 1.15 seconds
10,799,501 unique visits