当前位置:编程学习 > C#/ASP.NET >>

深度剖析Duwamish 7.0 (1--数据结构)

答案:不好意思啊,让大家久等了,第一次写这种文章,可能没有开心那么专业,废话少说,我们开始:

1.结构概述
Duwamish 7.0 结构分为四个逻辑层:
Web 层
Web 层为客户端提供对应用程序的访问。这一层是作为 Duwamish.sln 解决方案文件中的 Web 项目实现的。Web 层由 ASP.NET Web 窗体和代码隐藏文件组成。Web 窗体只是用 HTML 提供用户操作,而代码隐藏文件实现各种控件的事件处理。

业务外观层
业务外观层为 Web 层提供处理帐户、类别浏览和购书的界面。这一层是作为 Duwamish.sln 解决方案文件中的 BusinessFacade 项目实现的。业务外观层用作隔离层,它将用户界面与各种业务功能的实现隔离开来。除了低级系统和支持功能之外,对数据库服务器的所有调用都是通过此程序集进行的。

业务规则层
业务规则层是作为 Duwamish.sln 解决方案文件中的 BusinessRules 项目实现的,它包含各种业务规则和逻辑的实现。业务规则完成如客户帐户和书籍订单的验证这样的任务。

数据访问层
数据访问层为业务规则层提供数据服务。这一层是作为 Duwamish.sln 解决方案文件中的 DataAccess 项目实现的。
        
在这里,对于Duwamish 7.0的分布式结构我就不再罗嗦了,MSDN写的绝对比我好..

下面就从数据访问层开始解剖,我单独提出Customer这一段进行程序讲解:

1.CustomerData.cs(数据层)
Code:

//----------------------------------------------------------------
// Copyright (C) 2000-2001 Microsoft Corporation
// All rights reserved.
//
// This source code is intended only as a supplement to Microsoft
// Development Tools and/or on-line documentation. See these other
// materials for detailed information regarding Microsoft code samples.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
//----------------------------------------------------------------

namespace Duwamish7.Common.Data
{
    using System;
    using System.Data;
    using System.Runtime.Serialization;
    
    /// <summary>
    ///     A custom serializable dataset containing customer information.
    ///     <remarks>
    ///         This class is used to define the shape of CustomerData.
    ///     </remarks>
    ///     <remarks>
    ///         The serializale constructor allows objects of type CustomerData to be remoted.
    ///     </remarks>
    /// </summary>
    [SerializableAttribute]
    public class CustomerData : DataSet
    {
        //
        //Customer constants
        //
        /// <value>The constant used for Customers table. </value>
        public const String CUSTOMERS_TABLE = "Customers";
        /// <value>The constant used for Email field in the Customers table. </value>
        public const String EMAIL_FIELD     = "Email";
        /// <value>The constant used for Name field in the Customers table. </value>
        public const String NAME_FIELD      = "Name";
        /// <value>The constant used for Address field in the Customers table. </value>
        public const String ADDRESS_FIELD   = "Address";
        /// <value>The constant used for Country field in the Customers table. </value>
        public const String COUNTRY_FIELD   = "Country";
        /// <value>The constant used for Password field in the Customers table. </value>
        public const String PASSWORD_FIELD  = "Password";
        /// <value>The constant used for PhoneNumber field in the Customers table. </value>
        public const String PHONE_FIELD     = "PhoneNumber";
        /// <value>The constant used for Fax field in the Customers table. </value>
        public const String FAX_FIELD       = "Fax";
        /// <value>The constant used for PKId field in the Customers table. </value>
        public const String PKID_FIELD      = "PKId";
        //
        // Error messages
        //
        /// <value>The constant used for row error when 'Email Not Unique' field in CustomerData. </value>
        public const String EMAIL_FIELD_NOT_UNIQUE     = "Email Not Unique";
        /// <value>The constant used for row error when 'Email Invalid Format' field in CustomerData. </value>
        public const String EMAIL_FIELD_INVALID_FORMAT = "Email Invalid Format";
        /// <value>The constant used for row error when there is an 'Invalid Field' in CustomerData. </value>
        public const String INVALID_FIELD              = "Invalid Field";
        /// <value>The constant used for error when 'Invalid Fields' exist in CustomerData. </value>
        public const String INVALID_FIELDS             = "Invalid Fields";

        /// <summary>
        ///     Constructor to support serialization.
        ///     <remarks>Constructor that supports serialization.</remarks>
        ///     <param name="info">The SerializationInfo object to read from.</param>
        ///     <param name="context">Information on who is calling this method.</param>
        /// </summary>

上一个:ASP.NET移植须知
下一个:用C#实现无需iiS环境就可以执行aspx文件

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,