Sunday, 27 August 2017

Introducing ADO.NET

Introducing ADO.NET
As more and more companies are coming up with n-tier client/server and Web-based database solutions, Microsoft with its Universal Data Access (UDA) model,  offers high performance access to diverse data and information sources on multiple platforms. Also, UDA provides an easy-to-use programming interface that works with practically any tool or language, leveraging the technical skills developers already have.

The Microsoft UDA model is a collection of Data Access Components, which are the key technologies that enable Universal Data Access. The Data Access Components include ActiveX Data Objects (ADO), Remote Data Service (RDS), formerly known as Advanced Data Connector (ADC), Object Linking and Embedding Database (OLE DB), and Open Database Connectivity (ODBC).Microsoft is targeting many more such Data Access components that offer easy-to maintain solutions to organizations. Such solutions are aimed at allowing organizations use their own choice of tools, applications, and data sources on the client, middle tier, or server. One of the emerging components within the UDAs collection is ADO.NET.

ADO.NET Basics
Microsoft ADO.NET is the latest improvement after ADO. ADO.NET provides platform interoperability and scalable data access. In the .NET Framework, data is transmitted in the Extensible Markup Language (XML) format. Therefore, any application that can read the XML format can process data. It is not necessary for the receiving component to be an ADO.NET component at all. The receiving component might be a Microsoft Visual Studio–based solution or any application running on any other platform. 

ADO.NET builds the foundation of data-aware .NET applications. ADO.NET brings together all the classes that allow data handling. Such classes represent data container objects that feature typical database capabilities — indexing, sorting, and views. While ADO.NET offers a solution for .NET database applications, it presents an overall structure that is not as database-centric as the ADO model. ADO.NET also allows you to access data when disconnected from actual data sources. However, unlike ADO, ADO.NET uses XML as the data format. Because XML is a universal data format being used, ADO.NET expands the boundaries of interoperability to the Internet. In addition, instead of record sets, ADO.NET uses the DataSet and DataReader objects to access and manipulate data. Thus, ADO.NET is designed to perform better and be more flexible than ADO. Let us now look at the key features offered by ADO.NET is:

Interoperability
The ADO.NET model is designed to take maximum advantage of the flexibility provided by the large industry acceptance of XML. ADO.NET uses XML for transmitting datasets among components and across tiers. Any component that is capable of reading the XML format can process the data. It is not necessary for the receiving component to be an ADO.NET component. The component that is sending or transmitting the dataset can simply transmit the dataset to its destination without bothering with how the receiving component is implemented. The component asking for the dataset, the destination component can be implemented as a Visual Studio application or any other application. However, the important point to be considered is that the receiving component should be capable of accepting the XML file formatted as a dataset.

Maintainability
After an application is deployed, there might be a need for changes in the application. For example, the application might need substantial architectural changes to improve its performance. As the performance load on a deployed application server grows, system resources can become inadequate, resulting in higher response times. As a solution to these problems, the application might need to undergo architectural changes by adding tiers. Here, the problem is not the multitier application design, but rather the problem lies in increasing the number of tiers after an application is deployed. This transformation becomes easier if the original application is implemented in ADO.NET using datasets. In ADO.NET, the communication between tiers is relatively easy, because the tiers can transmit data through XML-formatted datasets.

Programmability
The ADO.NET model uses typed programming to manipulate objects. In typed programming, the programming environment or programming language itself recognizesthe types of things that are important to users. To take full advantage of typedprogramming, you must know the things that are of interest to programmers and to end users. This code is equivalent to a line using non-typed programming and is easier to read by end users. An end user who has little or no programming experience can easily grasp the meaning of the condition being tested. Also, in non-typed programming, if the developer makes a spelling mistake by chance (for example, ProductInfo is spelled as ProdcutInfo), a run-time error will get generated. On the other hand, in typed datasets, errors in the syntax caused by misspellings are detected at compile time rather than at run time.

Performance
In ADO, while transmitting data across tiers using COM marshalling in the form of disconnected RecordSets, the values must be converted to data types that are recognized by COM. This results in poor performance. On the other hand, ADO.NET is designed to use disconnected data architecture, which in turn is easier to scale because it reduces the load on database. Thus, in the ADO.NET model, everything is handled at the client side, which in turn improves performance.

Scalability
The Web-based, data-centric applications require multiple users to access data simultaneously. This increases the demand on data to be accessed, making scalability one of the most critical features. Applications that use resources, such as database connections and database locks, cannot support more users to access data simultaneously, because eventually the user demand for the limited resources will exceed their supply. Because ADO.NET uses disconnected data access, applications do not retain database locks or active database connections for long durations. Hence, ADO.NET accommodates scalability by encouraging programmers to conserve limited resources, and allows more users to access data simultaneously.

ADO.NET Object Model
The .NET Framework is designed to change dramatically the developer's current style of developing applications, including the data access features. For the .NET applications, the primary data access technology to be used would be ADO.NET — the latest addition to the ADO model. The ADO.NET Object Model is primarily divided into two levels:
Connected Layer: Consists of the classes that comprise the ManagedProviders
Disconnected Layer: Is rooted in the DataSet

Managed Providers
Managed Providers are a collection of classes in the .NET Framework that provide a foundation for the ADO.NET programming model. The .NET Framework allows you to write language-neutral components, which can be called from any language, such as C++ or Visual Basic. In the .NET Framework, the OLE DB and ADO layers are merged into one layer. This result in high performance and at the same time allows components to be called from any language. The Managed Provider for ADO.NET is the System. Data.OleDb namespace, which allows you to access OLE DB data sources. This namespace includes classes that are used to connect to OLE DB data sources and execute database queries to access and manipulate data.

DataSet class
The DataSet comprises the Disconnected Layer of ADO.NET. The DataSet consists of a local buffer of tables and relations. The DataSet object model consists of Tables, Columns, Relations, Constraints, and Rows. A DataSet contains a collection of DataTables (the Tables collection). A DataTable represents one table of in memory data.

1. A collection of columns (the Columns collection) that represents the table's schema.
2. A collection of rows (the Rows collection) that represent the data held by the table

A DataTable remembers the original state along with the current state, tracking the kinds of changes that have occurred. The data access classes are included in the System.Data namespace.

0 comments

Post a Comment