ADO .NET is a technology that was developed by Microsoft technology and it is also built on the .NET framework. The acronym for ADO is ActiveX Data Objects. ADO.NET gives us the facility to set up a bridge between backend technology and a database. However, this database could be both relational as well as non-relational.
According to Wikipedia – “ADO .NET is a data access technology from the Microsoft.NET Framework that provides communication between relational and non-relational systems through a common set of components. ADO .NET is a set of computer software components that programmers can use to access data and data services from a database. It is a part of the base class library that is included with the Microsoft.NET Framework”.
ADO stands for ActiveX Data Objects and it relies on COM whereas ADO .NET relies on managed providers defined by the .NET CLR (Common Language Runtime). ADO .NET provides consistent access to data sources such as SQL Server, as well as data sources exposed through OLE DB and XML. While there are similarities between ADO and ADO .NET, the way they operate and their foundations are quite different. The following are some Advantages of ADO .Net over ADO at a basic level.
A major difference in creating connections with ADO and ADO .NET is that ADO fits all connections to all types of data sources into a single Connection object. ADO .NET can have separate Objects that represent connections to different data sources. In ADO .NET you can create multiple data provider namespaces to connect specifically with a particular data source, making access faster and more efficient and allowing each namespace to exploit the features of its targeted data provider.
connection = new SqlConnection("connetionString");
connection = new OleDbConnection("connetionString");
ADO allows you to create client-side cursors only whereas ADO .NET gives you the choice of either using client-side or server-side cursors.
ADO .NET introduces a new way of getting a single value from a query's results when you expect only one row and one column to return. The ADO .NET command object has an ExecuteScalar method which returns the first row and column's value from its associated query.
ADO .Net dataset represents the in-memory representation of a database. ADO recordsets are merely a set of rows retrieved from a data source.
ADO recordsets can hold data from one data source at a time. ADO .Net datasets can hold data from various sources and integrate the data and write it back to one or several data sources.
The ADO .NET Framework supports two models of Data Access Architecture, Connection-Oriented Data Access Architecture and Disconnected Data Access Architecture.
In the case of Data Communication, ADO objects communicate in binary mode while ADO .NET uses XML for passing the data.
The ability to communicate across heterogeneous environments.
All communication involves data exchange, whether the communication between distributed components is through a request/response methodology or a message-based facility. Current distributed systems assume that the components involved in the communication are using the same protocol and data format. This assumption is too restrictive for a client base to expand across an enterprise or for multiple companies. Data-access layers should impose no such restrictions.
ADO.NET addresses the common data-exchange limitation by using XML as its payload data format. Since XML is text-based and simple to parse, it’s a good choice for a common, platform-independent, and transportable data format. Furthermore, because XML is nothing more than structured text, employing XML as the data format on top of the HTTP network protocol minimizes firewall-related problems. With ADO and its XML format, the clients do not have to know COM to de-serialize the packaged data. All they need is an XML parser, which is readily available in many flavors on many different platforms. The data producers and consumers need only adhere to the XML schema to exchange data among themselves.
The ability to serve a growing number of clients without degrading system performance.
ADO .NET moves away from the client/server model by promoting the use of disconnected datasets. When a client requests some data, the data is retrieved, it’s transferred to the client, and—as soon as possible—the connection is torn down. Since the connection between the client and the data source is short-lived, this technique allows more clients to request information from the server, thus solving the problem of limited connections.
You might think that setting up and tearing down connections is not a good idea since the cost of establishing a connection is usually high. This is a concern only in the absence of connection pooling. ADO .NET automatically keeps connections to a data source in a pool, so when an application thinks it is tearing down a connection, it’s returning it to the resource pool. This allows connections to be reused, avoiding the cost of reconstructing new connections from scratch.
Working with data in this disconnected fashion is not new to ADO programmers. The disconnected record set was introduced in early versions of ADO. However, in ADO, it is up to the developer to implement this feature, whereas, in ADO.NET, data is disconnected by nature.
The ability to quickly develop robust data access applications using ADO.NET’s rich and extensible component object model.
ADO . NET’s rich data access classes allow developers to boost their productivity. Current ADO developers should have no problems getting up to speed with the object model because ADO .NET is a natural evolution of ADO. The core functionality remains the same. With ADO .NET, the functionality is factored and distributed to each object in the model—much better than in previous versions of ADO. For example, the connection object is responsible only for connecting to and disconnecting from the data source. In ADO .NET, we can no longer execute a query directly through the connection object. Although some developers might miss this ability, it is a step in the right direction for the cohesion of component development.
ADO .NET also boosts developers’ productivity through extensibility. Because ADO .NET framework classes are managed code, developers can inherit and extend these classes to their custom needs. If you prefer not to do this low-level legwork, you can use Visual Studio. NET data-design environment to generate these classes for you.
In short, ADO .NET improves developers’ productivity through its rich and extensible framework classes. These features are complemented by the rich toolsets for ADO .NET in Visual Studio .NET, which enable rapid application development.
An improvement over previous ADO versions due to the disconnected data model.
Because ADO .NET is mainly about disconnected datasets, the system benefits from improved performance and scalability. The database server is no longer a bottleneck when the number of connection requests goes up. Data Providers in ADO .NET also enable implicit connection pooling, which reduces the time required to open a connection.
The previous marshaling of recordsets required type conversion to make sure that the data types were all COM-based. Since the disconnected dataset is in XML format, there is no need for this type of conversion during transport, as opposed to dealing with data in Network Data Representation format.
With the ADO .NET architecture, the data providers can be optimized for better performance by talking directly to the database server.
Subscribe to get latest updates