Original article: http://www.cnblogs.com/liuhaorain/archive/2012/02/06/2340409.html
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 compiling code that uses the System. Data namespace, you must reference System. Data. dll and System. Xml. dll. 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.
Original article: http://www.cnblogs.com/liuhaorain/archive/2012/02/06/2340409.html