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.

     

  • 相关阅读:
    主从数据库
    Linux 安装 mysql
    centos7.5上安装go1.13.4
    Linux 安装php
    CENTOS7下安装redis
    CentOS 7安装Etherpad(在线协作编辑)
    nginx《一安装》
    springboot中redis取缓存类型转换异常
    linux安装mysql
    linux上传下载文件(转载https://www.jb51.net/article/143112.htm)
  • 原文地址:https://www.cnblogs.com/rickie/p/228360.html
Copyright © 2011-2022 走看看