Designing and implementing a versatile data access tier for an ASP.NET applicationBy Paul Abarham In this article, we will drill down deeper in to the design of a n-tier architecture and our focus will be on the data access tier (DAT)
Abstract
Designed and implements a universal data access layer application for ASP.NET
Author paul abarham translation cwxiao888@163.com
In this article, we will in-depth design of the N-Tier architecture, and we will focus on DAT (DAT, DATA Access Tier).
Summary
In this article, we will drill down deeper in to the design of a n-tier architecture and our focus will be on the data access tier (DAT) (Figure 0) .Our goal is to design and implement an appropriate data access tier ( DAT) for scalable, reliable and interoperable web application. I have divided this article in to two major parts. in the first part, we will discuss about architectural goals, typed DataSet, EventLogs and HttpModules, which are helpful to understand the second part of .. this article We will build in the second part a small (but fine) n-tier application and our focus will be on design and implementation of data access tier You need a SqlServer (database: Northwind) and VS.net to follow this Article.
In this article, we will in-depth design of the N-Tier architecture, and we will focus on DAT (DAT, DATA Access Tier) (figure 0). Our goal is to design and implement an upgradeable reliability and coordinate DAT web application. I have divided into two main parts. In the first part, we will discuss the purpose of the architecture, Typed DataSet, EventLogs, and HttpModules, which is beneficial to understand the second part of this article. In the second part we will create a small (but very good) N-Tier application, and our focus is concentrated in design and implementing the DAT. You need a SQL Server (Database: Northwind) and VS.NET to operate with this document.
Contents: content
1. Designing Goals of A Data Access Tier (DAT) DAT Design Goal
1.1 Architectural Goals Architecture Target
1.2 Installation of the Prototype Prototype installation
1.3 Typed DataSets
1.4 Event Logs
1.5 httpmodules
2.0 Implementing Versatile Data Access Tier (DAT) Realizing Universal DAT
2.1 Implement Tier. A SUPER CLASS 2.2 a Performance Test to Evaluate SqldataReader and Dataset Objects in The Business Tier.
Evaluate the performance test of SqlDataReader and DataSet objects in Business Tier
2.3 How can I Extend this Data Access Tier (DAT) To Access Multi-Databases.
How can I extend this DAT to access multi-layer database (Access Multi-Databases)
2.4 How Can I Apply Database Transactions with Different Isolation Level?
How do I use Database TRANSETASE TRANST ISOLEL?
2.5 How can I INSERT AND RETRIEVE IMAGES?
How do I insert and retrieve an image?
Figure 0 Shows US A Typical 3 Tier Application That Is Dissected in To Three Major Disjunctive Layers, Which Are Data Tier (DA), Middle Tier and Presentation Tier (PT).
Figure 0 shows us a typical 3 Tier application that is divided into three main separation layers, Data Tier (DA), Middle Tier and Presentation Tier (PT).
If you are not family, i like to recommend Following Articles.
http://www.c-sharpcorner.com/tutorials/building3tierapppa.asp
http://www.c-sharpcorner.com/code/2002/june/adonetWindnaPective.asp
If you are not familiar with the N-Tier architecture, I recommend the following articles.
http://www.c-sharpcorner.com/tutorials/building3tierapppa.asp
http://www.c-sharpcorner.com/code/2002/june/adonetWindnaPective.asp
1. Designing An Appropriate Data Access Tier (DAT)
1.0 Architectural Goals
The Must Requirements of An Enterprise Application Can Be Expressed THROUGH The FOLLOWING BUZZWORDS
Interoperability and Extendibility, INTEROPERABILITY
Scalability and Performance
Reliability and ManageAbility
Security
Let us Look Some of the buzzwords closer, what do the really mean?
Interoperability deals with the ability of a system to communicate with other internal or external systems in a heterogeneous environment. This is a very important issue, because we need information to act just in time to meet needs of our customers and business partners. To achieve this important goal, our system must able to offer and consume web services.To be agile in your business, sometimes you need to extend your application. If we couple a system so tightly to other systems, then it may trigger a "modify avalanche" ( eg you pass data to via a peer application email, which represents data tables through comma separated columns. The recipient will open the email and parse it to gain information. Say, if we want add or change a column, then we have to modify other depending systems too because the order of columns have changed) .In order to avoid "modify avalanches", we must couple systems loosely using technologies such like Web services (preciously: XML supported technologies) .
SCALABILITY IS A MEASURE Which Describes The Ability of a System To Increase Performance by Adding Additional System Resources .a System Applies Following Strategies To Be ScALABLE.
IT Must Able To Allocate New Resources To Satisfy Increasing User Requests.
IT Must Use Algorithms and Data Structures Which Won't occupy resource for long time.
SCALABILITY IS A VERY IMPORTANT ISSUE, BECAUSE You Can Invest In A System Will Grow with the business.
Reliability of a software system can be defined as the probability that a system will perform its task without failure. To achieve higher reliability, a system must provide utilities to track possible errors.
Figure 1 shows partial ER-Diagram of the database NorthwindSo, we have now great goals. In order to achieve these goals, we have to lay a proper groundwork. Our data access tier (DAT) must be designed to accomplish the following tasks.
IT Must Enable US to Interact with Set of Data Sources and to Coordinate Transactions Among THEM
IT Must Be flexible to Use Different Data Access Technologies (SqlDataAdapter and Dataset), Because this issesue deals with schelability and performance of your system.
It must support presentation tier (PT) to display coherent data tables. Most of interrelated tables of a relational database are modeled according to master-detail (Parent-Child) relationship. In our database example (see Fig 1), you can find out some these duos and they are:. Customers-Orders Orders-Order Details There is always a need in the presentation tier (PT) to drill down the master table to expose details The Figure 2 displays the master-detail relationship Customer-Order.. .
IT Must Provide Infrastructure to TRACE AND ieze.
Figure 2 shows a screen shot of the demo web application daprototype
1.2 Installation of the Prototype
Before We Move Further, I Recommend You to Install The Sample Application Daprototype, So That You Can Refer It Time To Time. The Solution Daprototype.sln Consists Following Class Libraries (See Fig 3).
Assembly Description BLT Assembly for the business logic tier DAT Assembly for the data access tier HttpTraceModule contents a HttpModule to trace errors in the presentation layer TDS Contents typed datasets which serve as a vehicle to transport data between the tiers
Figure 3
Please follow these instruction to install the sample application:
Download The File Daprototype.zipcreate a New ASP.NET C # Web Application Daprototype and Replace It With The File Which You Have Downloaded.
Open and Execute The SQL Script Daprototype / Sqlscript / Daprototype.sql, in Order to Create Store Procedures on The Database NortWind Which Area of Our Data Tier (DT)