Summary
As. NET Framework is one of the most important components of ADO. NET plays an important role in the interaction of applications with data. This article will discuss the ADO from the macroscopic point of view, and together with you to understand the ADO and the main component of ADO.
Directory
- What is ADO?
- Clarify the relationship between ADO
- Recognize the core components of ADO
- Ado. NET extension
1. What is ADO?
Simply speaking,ADO. NET is a set of technologies that allow. NET developers to interact with data in a standard, structured, and even non-connected way. for ADO, data sources can be processed in a variety of forms. Can be the only data that an application uses to create in-memory data, or it can be separated from the application, stored in a storage area (such as text files, XML, relational databases, and so on).
Specifically, ADO provides consistent access to data sources such as Microsoft SQL Server and XML, and to data sources exposed through OLE DB and XML. Data sharing consumer applications can use ADO to connect to these data sources and retrieve, process, and update the contained data.
As. NET framework, the ADO class is encapsulated in System.Data.dll and integrates with the XML classes in the System.Xml.dll. When compiling code that uses the System.Data namespace, you need to reference System.Data.dll and System.Xml.dll.
2. Clarify the relationship between ADO
As an ordinary abbreviation, "ADO" is not a simple upgrade version of "ADO". Strictly speaking,ADO. NET and ADO are two distinct ways of accessing data .
The full name of ADO is ActiveX Data Objects, which is an early (. NET has not yet been implemented) the components that developers use to access data. With. NET of development, ADO. NET shun its naturally with its remarkable superiority gradually replace ADO. Technically speaking, ADO uses the OLE DB interface and is based on Microsoft's COM technology, and ADO has its own ADO-based Microsoft. NET Architecture.
Although most new. NET-based applications will be written using ADO,. NET programmers can still use ADO through the. NET COM Interoperability service.
3. Understanding the core components of ADO
The System.Data namespace provides different types of ADO, which are both well-defined and collaborative in providing tabular data access services. The class library contains two important sets of classes: a set of actual data (datasets) that are responsible for processing the internal software, and a set of data Provider that is responsible for communicating with external systems. The specific architecture is as follows:
Figure 1.3.1 ADO. NET Core Components
The DataSet is the core component of the disconnected (fractured) structure of ADO. the dataset is designed to be clear: to achieve data access independent of any data source. Therefore, ADO. NET structure can be used for many different data sources, for XML data, or for managing data that is local to the application. The dataset contains a collection of one or more DataTable objects that consist of data rows and data columns, as well as primary keys, foreign keys, constraints, and relational information about the data in the DataTable object.
Another core element of the ADO structure is the. NET Data Provider (Provider). Details include:
- The Connection object provides a connection to the data source.
- The Command object enables you to access database commands that return data, modify data, run stored procedures, and send or retrieve parameter information.
- The DataReader object provides a fast, read-only stream of data from the data source.
- The DataAdapter object provides a bridge that connects a DataSet object to a data source. DataAdapter uses the command object to execute SQL commands in the data source to load data into the dataset and to make changes to the data in the dataset consistent with the data source.
4. ADO. NET extension
Providing consistent data access is a key advantage of using ADO. But the bigger advantage for developers is that it is handled by ADO to manage the data as an object. Each field in the table is a strongly typed member and is fully compatible with the. NET Common Type System (Common type systems). Individual fields can even be used as local variables. Data rows or other dataset objects are standard. NET Collections (collections) that can be handled with a standard iterative approach.
The Entity Framework and LINQ are the two new tools Microsoft has built to improve the core functionality of ADO. It is important to note that they are not an essential part of ADO .
The Entity Framework takes advantage of the abstraction of data structures to convert each database object into an Application object (entity), and the data fields are converted to properties, and the relationships are converted to associative attributes (association), so that the database's e/r The model is completely turned into an object model. In the abstract structure, it is a highly integrated and corresponding structure of the concept layer, the corresponding layer and storage layer, as well as supporting the Entity Framework of the data provider (provider), so that the work of data access is smooth and complete.
LINQ allows you to write C # or Visual Basic code to manipulate memory data in the same way as querying a database. LINQ is a common data tool that allows you to easily fuse data from different data sources and get a single set of data results.
Ado. NET Getting Started tutorial (a) initial knowledge of ADO