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

     

  • 相关阅读:
    plsql developer中各个window的作用【转】
    回忆java输入输出流,走出误区
    JDBC中的元数据
    对于Oracle、mysql和sql server中的部分不同理解
    我对数据库事务的理解(MYSQL中)
    关于mysql的备份和恢复
    mysql触发器学习
    mysql存储过程学习
    JavaScript位运算符
    【JavaScript】数组随机排序 之 Fisher–Yates 洗牌算法
  • 原文地址:https://www.cnblogs.com/rickie/p/228360.html
Copyright © 2020-2023  润新知