XML and ADO.NET
ADO.NET
can be used as a powerful XML middleware. Although coming from ADO, it has been
entirely redesigned for a better support for Web applications. A main feature
of ADO.NET is its disconnected recordsets, known as DataSet. It acts as a
feature-rich in-memory database or data cache. In other words, it does not
maintain any database server cursors. All recordset’s database characteristics
are available in DataSet, such as sorting, paging, filtered views, relations,
indexing, and primary/foreign keys.
Native
support for XML is another principal feature for ADO.NET. In native mode, record
tables are stored as XML documents where schema and data are treated as
distinct and replaceable elements. It is quite different from ADO. The ADO
native storage format for a recordset is the Advanced Data Table Gram (ADTG)
file format, which is a proprietary, binary schema that represents a
recordset’s in-memory image. The DataSet objects in ADO.NET can load its data
from variant sources: a database server, a local or remote XML file and any
accessible system resources. Once the data is loaded, they can be either
treated as a record table or a virtual XML document. We principally discuss the
latter. Now, I will give you several use cases. Each use case is a standalone
unit test which can be run under NUnit. So you should install a latest version
of NUnit. More information about its installation and usage can be found.
Before
executing these examples, you should also setup an ODBC connection for the
database with the following steps:
1. Extract
the download package. There is an access file ―NWIND_2002.MDB‖ in the folder ―UnitTest_ADO.NET_XML‖.
2. Open
Control Panel -> Administrative Tools -> Data Source.
3. Choose
the System Data Sources tab.
4. Click
―Add‖ button and choose ―Microsoft Access Driver (*.mdb)‖ from the list. Then
an
ODBC
configuration dialog appears.
5. Enter
―XmlDb_NorthWind‖ as the Data Source Name (DSN), and choose the Access file ―NWIND_2002.MDB‖ as the data source.
Related Topics
Privacy Policy, Terms and Conditions, DMCA Policy and Compliant
Copyright © 2018-2023 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.