ArticleDirectory
Summary
As one of the most important components of the. NET Framework, ADO. Net plays an applicationProgramAn important role that interacts with data. This article will discuss ADO. Net from a macro perspective and share with you the main components of ADO. net.
Directory
- What is ADO. Net?
- Clarify the relationship between ADO. NET and ADO
- Understanding the core components of ADO. net
- Ado. Net Extension
1. What is ADO. Net?
To put it simply,Ado. Net is a set of techniques that allow. NET developers to interact with data in a standard, structured, or even connectionless manner.For ADO. net, various data sources can be processed. It can be the only data created in the memory or separated from the application and stored in the storage area (such as text files, XML files, and relational databases ).
Specifically, ADO. NET provides consistent access to data sources such as Microsoft SQL Server and XML and data sources exposed through OLE DB and XML. Data sharing user applications can use ADO. Net to connect to these data sources and retrieve, process, and update the data contained.
As an important part of the. NET Framework, the ADO. Net class is encapsulated in system. Data. dll and integrated with the XML class in system. xml. dll. When the system. Data namespaceCodeSystem. Data. dll and system. xml. dll must be referenced.
2. clarify the relationship between ADO. NET and ADO
As a common acronyms, "ADO. Net" is not a simple upgrade version of "Ado. Strictly speaking,ADO. NET and ADO are two completely different data access methods..
The full name of ADO is ActiveX Data Objects, which is a component used by early developers to access data (not implemented by. net. With the development of. net, ADO. Net gradually replaces ADO with its obvious superiority. Technically speaking, ADO uses the ole db interface and is based on Microsoft's COM technology, while ADO. Net has its own ADO. net interface and is based on Microsoft's. NET architecture.
Although most new. Net-based applications will be written using ADO. net,. Net programmers can still use ADO through the. NET com interoperability service.
3. Understand the core components of ADO. net
The system. Data namespace provides different ADO. Net classes, which provide table data access services in a clear and collaborative manner. This class library contains two important classes: one is responsible for processing the actual data (Dataset) inside the software, and the other is responsible for communicating with the External Data System (data provider ). The specific architecture is shown in:
Figure 1.3.1 Core Components of ADO. net
Dataset is the core component of the non-connection (disconnection) structure of ADO. net.Dataset is designed to achieve data access independent from any data source. Therefore, the ADO. net structure can be used for different data sources, XML data, or local data management of applications. Dataset contains a set of one or more able objects, which are composed of data rows and data columns, as well as primary keys, foreign keys, constraints, and information about the relationship between data in the datatable object.
Another core element of the ADO. net structure is the. NET data provider ). Including:
- The connection object provides a connection to the data source.
- The command object allows you to access database commands used to return data, modify data, run stored procedures, and send or retrieve parameter information.
- The datareader object provides fast, read-only data streams from the data source.
- The dataadapter object provides a bridge between the DataSet object and the data source. Dataadapter uses the command object to execute SQL commands in the data source to load data to dataset and make changes to the data in dataset consistent with the data source.
4. Ado. Net Extension
Providing consistent data access is a key advantage of using ADO. net. However, for developers, the greater advantage is that they process managed data as objects through ADO. net. Each field in the table is a strongly typed member and fully compatible with the. NET Common Type System. Individual fields can even be used as local variables. Data rows or other dataset objects are standard. net collections and can be processed using standard iteration methods.
Entity Framework and LINQ are two new tools established by Microsoft to improve the core functions of ADO. net. Note that theyIt is not a basic component of ADO. net..
The Entity Framework converts each database object to an application object (entity) using the abstract data structure, and converts data fields to properties ), the relationship is converted to Association, and the E/R Model of the database is fully converted into an object model. Under the abstract structure, it is the concept layer, corresponding layer and storage layer of highly integrated and corresponding structure, and the data provider (provider) that supports Entity Framework ), this enables smooth and complete data access.
LINQ allows you to write C # Or Visual Basic code to query memory data in the same way as a database. As a common data tool, you can easily integrate data from different data sources and obtain a single data result set.