分享
 
 
 

设计并实现用于ASP.NET一个通用的数据存取层应用程序 原作者 Paul Abarham 翻译 cwxiao888@163.com

王朝asp·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

Designing and implementing a versatile data access tier for an ASP.NET application

By 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

设计并实现用于ASP.NET一个通用的数据存取层应用程序

作者 Paul Abarham 翻译 cwxiao888@163.com

在此文中,我们将深入研究n-tier架构的设计,而且我们将聚焦于DAT (DAT,data access tier) 。

摘要

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.

在此文中,我们将深入研究n-tier架构的设计,而且我们将聚焦于DAT (DAT,data access tier) (Figure 0) 。我们的目标是设计并实现一个可升级的可靠并且相互协同DAT网络应用程序。我已将本文分成两个主要的部分。 在第一部分中,我们将讨论有关于架构的目的,typed DataSet,EventLogs和HttpModules,这有益于理解本文的第二部分。 在第二个部分中我们将创建一个小的(但是很好) n-tier应程序,而且我们的焦点集中在在设计和实现DAT。 你需要一个SqlServer (数据库:Northwind )和VS.net来跟随本文进行操作。

Contents:内容

1. Designing Goals of a data access tier(DAT)DAT的设计目标

1.1 Architectural Goals 架构目标

1.2 Installation of the prototype prototype的安装

1.3 Typed DataSets

1.4 Event Logs

1.5 HttpModules

2.0 Implementing versatile data access tier(DAT) 实现通用的DAT

2.1 Implemeting a super class for data access tier. 实现一个用于DAT的超类(super class)

2.2 A performance test to evaluate SqlDataReader and DataSet objects in the business tier.

评估商业层(business tier)中SqlDataReader 和 DataSet对象的性能测试

2.3 How can I extend this data access tier (DAT) to access multi-databases.

我如何才能扩展此DAT至存取多层数据库(access multi-databases)

2.4 How can I apply database transactions with different isolation level?

我如何应用不同隔离等级(different isolation level)的数据库处理(database transactions)?

2.5 How can I insert and retrieve images?

我怎样插入和检索图象?

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给我们展示了一个典型的3 Tier应用,它被分成三个主要的分离层,data tier (DA),middle tier 和 presentation tier (PT)。

If you are not familiar with n-tier architecture, I like to recommend following articles.

http://www.c-sharpcorner.com/Tutorials/Building3TierAppPA.asp

http://www.c-sharpcorner.com/Code/2002/June/AdoNetWinDNAPerspective.asp

如果你对n-tier架构不太熟悉,我给你推荐下列文章。

http://www.c-sharpcorner.com/Tutorials/Building3TierAppPA.asp

http://www.c-sharpcorner.com/Code/2002/June/AdoNetWinDNAPerspective.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

Scalability and Performance

Reliability and Manageability

Security

Let us look some of the buzzwords closer, what do they 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” (e.g. you pass data to a peer application via 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 with the confidence that the 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 Northwind

So, 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 issue deals with scalability 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 analyze errors .

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.zip

Create 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 are part of our data tier (DT)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有