首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > .NET > C#.NET > N-Tier application design using Visual Studio 2005 (Draft)
【标  题】:N-Tier application design using Visual Studio 2005 (Draft)
【关键字】:N-Tier,application,design,using,Visual,Studio,2005,Draft
【来  源】:http://rickie.cnblogs.com/archive/2005/09/02/228360.html

N-Tier application design using Visual Studio 2005 (Draft)

N-Tier application design using Visual Studio 2005 (Draft)

 

Posted by Rickie Lee on Sept. 1, 2005

rickieleemail@yahoo.com

http://rickie.cnblogs.com/

According to a few days research on new features of VS 2005 and SQL Server 2005, there are many built-in features from VS 2005, which will result in different N-Tier application design. The following article is just my current ideas about N-Tier application design using Visual Studio 2005.

 

1. User Interface Layer

This layer will interact with end users and usually contains some data-bound controls, OjectDataSource controls and so on.

 

The ObjectDataSource control acts as a data source for the data-bound controls, which simply display all the data in the user interface layer. An ObjectDataSource control is a new control that is introduced with Visual Studio 2005 that greatly simplifies the way in which the middle tier business objects are consumed from a Windows Form or Web page.

 

With this control, we can simply bind an output of an object’s method directly to data-bound controls such as GridView, dropdown list and so on.

 

The ObjectDataSource control is used to instantiate the related business object that will then retrieve the required data from the back-end database through the specified business object’s method.

 

2. Business Rules Layer

In this layer, business object will implement complicated business logic, retrieve database and return data, which can be bound to an ObjectDataSource control, such as a DataSet, XmlDocument, or Collection.

 

The following code snippet is part of an Employee class, which will return employee collection object to the calling program. (Note that it’s from 101 Samples for Visual Studio 2005)

static public System.Collections.Generic.List<Employee> LoadEmployees(DataTable employeesData)
{
    System.Collections.Generic.List
<Employee> employees = new List<Employee>();
    
for (int i = 0; i < employeesData.Rows.Count; i++)
    {
        DataRow employeeData 
= employeesData.Rows[i];
        Employee employee 
= new Employee(employeeData);
        employees.Add(employee);
    }

    
return employees;
}

 

3. Data Access Layer

With the introduction of VS 2005, a new TableAdapter Configuration Wizard has been introduced. Through this new feature, we can create a data access logic layer component (usually a strongly typed DataSet) without having to write any code.

 

But currently I still prefer to use a general data access component to communicate with back-end database server, such as DAAB. I think, in this way, application architecture is more scalable and flexible. In the meanwhile, all T-SQL scripts will be handled in the business rules layer or database objects, such as stored procedures or user defined functions, and so on.

 

4. Database Server

This layer is made up of a RDBMS database component, such as SQL Server that provides the mechanism to store and retrieve data. But with the introduction of SQL Server 2005, a new feature, CLR-based stored procedures or other objects, has been introduced.

 

Stored procedures using managed code, such as C# and VB.NET, can provide performance improvements and usually handle some complicated business logic and calculations.

 

***

In this article, I’ve just presented my current elementary understanding about VS 2005, SQL Server 2005 and .Net Framework 2.0. More articles will be posted in the later time.

 

Refactor feature in Visual Studio 2005:【上一篇】
Creating CLR-based Stored Procedures in C# and VS 2005:【下一篇】
【相关文章】
  • Refactor feature in Visual Studio 2005
  • New patterns & practices for Visual Studio 2005 and .NET 2.0
  • Visual Studio 2005 Starter Kits
  • SQL Server 2005 Beta3编辑器的一个小Bug
  • GDI+绘制的一个Report Designer原型
  • 希望VS.NET 2005能提供48x48的图标
  • 安装Vistual Studio 2005的小问题
  • MOM 2005 是个好东西
  • Web讲座:VC++ 2005 确定性资源清理 (Deterministic Cleanup )
  • VC++ 2005 (C++/CLI) 系列Web讲座
  • 【随机文章】
  • 第2章使用find和xargs
  • 09月26日病毒预警
  • Windows管道技术
  • 豆瓣阿北布道Feedsky技术交流会
  • Linux基本命令的使用(续3)
  • LINUX下Web服务器配置
  • Lucene的学习
  • Director 8.5 简单基础实例教程(1)
  • 面向对象的方法
  • 挂QQ的网页源代码
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.