Windows DNA is a framework to build multi-tier, high performance, scalable distributed applications over the network. This article takes a Windows DNA perspective and compares how ADO.NET fits in Windows DNA.
Windows DNA (Distributed InterNet Applications) is a framework that describes how to develop multi-tier, high performance, scalable distributed applications over the network. The heart of DNA is an integrated programming model based on COM+. ADO.NET components are applicable in all layers of Windows DNA through XML schemas and data sets. Before we see ADO.NET components architecture, let's take a quick look at Windows DNA architecture and how do ADO.NET components fit in it.
Windows DNA Architecture
Figure 1 shows Windows DNA components and relationship among them. As you can see from this figure, Windows DNA is a set of services, tools, and three layers of application layers - presentation layer, business logic layer, and database layer.
Figure 1. Windows DNA Architecture
Now let's discuss these layers in more details and their role and responsibility in the architecture.
1. The Presentation Layer
This layer is responsible for information gathering from user, performing basic validation of user input, sending it to the business layer and again receiving results of the business layer and presenting these results to the user in a viewable formats such as VB forms. This layer consists tools such as VB, HTML, DHTML, Win32 applications, Client-Server scripting, Java Applets, Netscape Plug-Ins, ActiveX controls.
2. The Business Layer
This layer is responsible for receiving input from the presentation layer, interacting with the data access layer to process the information and sending back the processed information to the presentation layer. This layer provides business rules and services to help to write scalable applications. These services are tightly integrated with each other and the underlying operating system and exposed in a unified way through COM. They include the following:
- Web services, through Microsoft Internet Information Server ( IIS ).
- Transaction and component services, through Microsoft Transaction Server ( MTS ).
- Queuing and asynchronous services, through Microsoft Message Queue Server ( MSMQ).
- Server-side scripting, via Active Server Pages (ASP).
- Interoperability services, such as the COM Transaction Integrator ( COMTI ) for accessing the IBM Customer Information Control System (CICS) and IBM Infromation Management Systems (MIS).
3. The Data Access Layer
This layer directly interacts with the data, which usually reside in the databases such as SQL Server, Oracle, text files, mail or other formats such as binary. This layer is responsible for storage, retrieval, and general maintenance of data as well integrity of data. The Windows DNA approach of data access is called "Universal Data Access'. UDA is a set of system level and application level programming models called OLE-DB, ADO and RDO.
ADO.NET and Windows DNA
Similar to COM+, the CLR is the heart of the .NET framework. Here I will not go in more depth of .NET architecture but .NET sure provides more tools and services for developers than the Windows DNA. In this article, I will try to limit this article as an ADO.NET introduction from a Windows DNA developer's perspective.
ADO.NET components are applicable in all layers of Windows DNA. Even though there is no relation between Windows DNA and ADO.NET nor it was .NET was designed to fit in Windows DNA model but developers who have been developing application based on the Windows DNA guidelines may want to compare the ADO.NET functionality with the present .NET model.
In .NET, the representation layer normally is represented through Windows Forms and Web Forms. Windows Forms is a framework to write Windows GUI desktop applications. Windows Forms work pretty similar to Visual Basic forms. The Web Forms with the help of ASP.NET (new and extended version of ASP) provides services and classes to write Web based GUI applications.
Figure 2 shows the ADO.NET components in different layers of Windows DNA.
As you can see from the above diagram, the database layer itself has no changes. You can still use same databases and apply same logic on the database itself as you used to do prior to .NET.
ADO.NET in business layer is little more complex and most of the ADO.NET components belong to this layer. As you can see from the above figure, in ADO.NET, you connect to a data source through Data Connection and Data Adapters. You can either create a Connection object explicitly and attach it with a DataAdapter or you can direct create a DataAdapter with a connection at design time with the help of designer, which attaches a connection to a DataAdapter. DataAdapters provide functionality to fill data from the data source to DataSet objects and write data back to the data source through DataSets. A DataSet object can be used to connect to data-bound controls used in Windows Forms and Web Forms such as a DataGrid. XML Schemas play a vital role. XML is the way to transfer data from a data source to a client. Actually a DataSet object is a disconnected data stored in the form of XML on your local machine. No matter if you use Web Forms or Windows Forms, when you read data in a DataSet, data stored as a disconnected data and you can do data-access operations (read, write, and update) on this data without even an connection with actual data source. After doing your data-access operations, you call DataAdapter to save the change data back to the data source.
A DataSet is a collection of DataTables. A DataTable is an in-memory representation of a database table. The DataTable provides functionality to navigate through each rows or columns of a table and work with them, which means you can read, write, and update data to a DataTable based on rows and columns. This is the ADO's Recordset replacement in ADO.NET.
Data can be accessed from a data source through Command objects, which are used to execute SQL statements. After executing SQL command, data is read in DataReader objects, which are read only objects and fill the result of SQL statement executed using the Command object.
Data can also be saved and accessed in XML documents through .NET XML classes, which are independent of ADO.NET classes. But ADO.NET provides a way to read and write XML documents to a data source back and forth.
The Presentation layer of the .NET framework is much more powerful and flexible than the Presentation layer of Windows DNA. Windows Forms, XML, Web Forms, and ASP.NET provides tools and services to write much more robust, fast, better design and much improved than the versions used in Windows DNA.
Even though there is no relation between Windows DNA and the .NET Framework's ADO.NET API but still you can compare both as a Windows DNA developer's perspective. This is what I tried to do in this article. Hope you found this article useful.