zoukankan      html  css  js  c++  java
  • NTier 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.

     

  • 相关阅读:
    勤于思考:jquery.getJSON的缓存问题的解决方法
    步步为营:SQLServer查询随机不相同的记录插入临时表
    勤于思考:Asp.Net MVC Html.TextBoxFor日期格式化
    勤于思考:Excel写公式换算单元格求积等
    步步为营:ASP.NET MVC中Area分层模块处理大解密
    步步为营:因为数据库正在使用,所以无法获得对数据库的独占访问权
    勤于思考:从客户端中检测到有潜在危险的 Request.Form 值
    Android天天数钱游戏项目源码
    iOS猜拳游戏源码
    李开复:AlphaGo 若打败了世界冠军,意味着什么?
  • 原文地址:https://www.cnblogs.com/rickie/p/228360.html
Copyright © 2011-2022 走看看