PetShop4分析随手贴

PetShop4分析随手贴 PetShop4简析  跟踪顺序为1.Web/Controls/ItemsControl.ascx.cs2./BLL/Item.cs(此处用工厂实现下面的Item)3./IDAL/IItem.cs/DALFactory/DataAccess.cs(工厂)/Web/web.config(path)/SQLServerDAL/Item.cs(IItem的实

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE稳定放心使用

 

PetShop4
简析
 
 
跟踪顺序为
1.Web/Controls/ItemsControl.ascx.cs
2./BLL/Item.cs (此处用工厂实现下面的Item)
3./IDAL/IItem.cs
/DALFactory/DataAccess.cs(工厂)
/Web/web.config(path)
/SQLServerDAL/Item.cs(IItem的实现类)
 
 
具体代码实现如下(UI->BLL->DAL)

Web/Controls/ItemsControl.ascx.cs
using
System;
using
System.Web;
using
System.Web.UI.WebControls;
using
PetShop.BLL;
using
PetShop.CacheDependencyFactory;
 
namespace
PetShop.Web {
    public partial class ItemsControl : System.Web.UI.UserControl {
       
        ///<summary>
        /// Rebind control
        ///</summary>
        protected void PageChanged(object sender, DataGridPageChangedEventArgs e) {
            //reset index
            itemsGrid.CurrentPageIndex = e.NewPageIndex;
 
            //get category id
            string productKey = Request.QueryString[“productId”];
 
            //bind data           
            Item item = new Item();
            itemsGrid.DataSource = item.GetItemsByProduct(productKey);
            itemsGrid.DataBind();
 
        }
    }
}
 
/BLL/Item.cs
using
System.Collections.Generic;
using
PetShop.Model;
using
PetShop.IDAL;
 
namespace
PetShop.BLL {
 
    ///<summary>
    /// A business component to manage product items
    ///</summary>
    public class Item {
 
        // Get an instance of the Item DAL using the DALFactory
        // Making this static will cache the DAL instance after the initial load
        private static readonly IItem dal = PetShop.DALFactory.DataAccess.CreateItem();
                
         ///<summary>
         /// A method to list items by productId
         /// Every item is associated with a parent product
         ///</summary>
         ///<param name=”productId”>The productId to search by</param>
         ///<returns>A Generic List of ItemInfo</returns>
         public IList<ItemInfo> GetItemsByProduct(string productId) {
 
              // Validate input
              if(string.IsNullOrEmpty(productId))
                   return new List<ItemInfo>();
 
              // Use the dal to search by productId
              return dal.GetItemsByProduct(productId);
         }
 
        ///<summary>
        /// Search for an item given it’s unique identifier
        ///</summary>
        ///<param name=”itemId”>Unique identifier for an item</param>
        ///<returns>An Item business entity</returns>
        public ItemInfo GetItem(string itemId) {
 
            // Validate input
            if (string.IsNullOrEmpty(itemId))
                return null;
 
            // Use the dal to search by ItemId
            return dal.GetItem(itemId);
        }
    }
}
 
 
/IDAL/IItem.cs
using
System;
using
System.Collections.Generic;
 
//References to PetShop specific libraries
//PetShop busines entity library
using
PetShop.Model;
 
namespace
PetShop.IDAL {
 
     ///<summary>
     /// Interface to the Item DAL
     ///</summary>
     public interface IItem{
        
         ///<summary>
         /// Search items by productId
         ///</summary>
         ///<param name=”productId”>ProductId to search for</param>
        ///<returns>Interface to Model Collection Generic of the results</returns>
         IList<ItemInfo> GetItemsByProduct(string productId);
 
         ///<summary>
         /// Get information on a specific item
         ///</summary>
         ///<param name=”itemId”>Unique identifier for an item</param>
         ///<returns>Business Entity representing an item</returns>
         ItemInfo GetItem(string itemId);
     }
}
 
/DALFactory/DataAccess.cs
 
using
System.Reflection;
using
System.Configuration;
 
namespace
PetShop.DALFactory {
 
    ///<summary>
    /// This class is implemented following the Abstract Factory pattern to create the DAL implementation
    /// specified from the configuration file
    ///</summary>
    public sealed class DataAccess {
 
        // Look up the DAL implementation we should be using
        private static readonly string path = ConfigurationManager.AppSettings[“WebDAL”];
        private static readonly string orderPath = ConfigurationManager.AppSettings[“OrdersDAL”];
       
        private DataAccess() { }
 
        public static PetShop.IDAL.ICategory CreateCategory() {
            string className = path + “.Category”;
            return (PetShop.IDAL.ICategory)Assembly.Load(path).CreateInstance(className);
        }
 
        public static PetShop.IDAL.IInventory CreateInventory() {
            string className = path + “.Inventory”;
            return (PetShop.IDAL.IInventory)Assembly.Load(path).CreateInstance(className);
        }
 
        public static PetShop.IDAL.IItem CreateItem() {
            string className = path + “.Item”;
            return (PetShop.IDAL.IItem)Assembly.Load(path).CreateInstance(className);
        }
 
        public static PetShop.IDAL.IOrder CreateOrder() {
            string className = orderPath + “.Order”;
            return (PetShop.IDAL.IOrder)Assembly.Load(orderPath).CreateInstance(className);
        }
 
        public static PetShop.IDAL.IProduct CreateProduct() {
            string className = path + “.Product”;
            return (PetShop.IDAL.IProduct)Assembly.Load(path).CreateInstance(className);
        }
 
    }
}
 
 
/Web/web.config
 
<?
xml
version
=
1.0?>
<
configuration
xmlns
=
http://schemas.microsoft.com/.NetConfiguration/v2.0>
     <
connectionStrings
configProtectionProvider
=
RsaProtectedConfigurationProvider>
         <
EncryptedData
Type
=
http://www.w3.org/2001/04/xmlenc#Elementxmlns=http://www.w3.org/2001/04/xmlenc#>
              <
EncryptionMethod
Algorithm
=
http://www.w3.org/2001/04/xmlenc#tripledes-cbc/>
              <
KeyInfo
xmlns
=
http://www.w3.org/2000/09/xmldsig#>
                   <
EncryptedKey
xmlns
=
http://www.w3.org/2001/04/xmlenc#>
                       <
EncryptionMethod
Algorithm
=
http://www.w3.org/2001/04/xmlenc#rsa-1_5/>
                       <
KeyInfo
xmlns
=
http://www.w3.org/2000/09/xmldsig#>
                            <
KeyName
>
Rsa Key</KeyName>
                       </
KeyInfo
>
                       <
CipherData
>
                            <
CipherValue
>
NrTRoEqZ1heJDQKp5vLf/vfn+JwusYDwL7c9QFU3FJTeRikKLKaT5Rsa27NzCuU3N9ClxOXBc8hz8h9xO/2LRczJGqAopjhNF77YCV3n28oAXZEC44ePtUQpDhgq9u5EkLkRrBR8zuXidyhU5g0ORGYXtse05jRsZLiNWRpoAyg=</CipherValue>
                       </
CipherData
>
                   </
EncryptedKey
>
              </
KeyInfo
>
              <
CipherData
>
                   <
CipherValue
>
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</CipherValue>
              </
CipherData
>
         </
EncryptedData
>
     </
connectionStrings
>
     <
appSettings
>
         <!–
Pet Shop DAL configuration settings. Possible values: PetShop.SQLServerDAL for SqlServer, PetShop.OracleServerDALfor Oracle.
–>
         <
add
key
=
WebDALvalue=PetShop.SQLServerDAL/>
         <
add
key
=
OrdersDALvalue=PetShop.SQLServerDAL/>
         <
add
key
=
ProfileDALvalue=PetShop.SQLProfileDAL/>
         <!–
Enable data caching
–>
         <
add
key
=
EnableCachingvalue=true/>
         <!–
Cache duration (in hours-whole number only)
–>
         <
add
key
=
CategoryCacheDurationvalue=12/>
         <
add
key
=
ProductCacheDurationvalue=12/>
         <
add
key
=
ItemCacheDurationvalue=12/>
         <!–
Cache dependency options. Possible values: PetShop.TableCacheDependency for SQL Server and keep empty for ORACLE
–>
         <
add
key
=
CacheDependencyAssemblyvalue=PetShop.TableCacheDependency/>
         <!–
CacheDatabaseName should match the name under caching section, when using TableCacheDependency
–>
         <
add
key
=
CacheDatabaseNamevalue=MSPetShop4/>
         <!–
*TableDependency lists table dependency for each instance separated by comma
–>
         <
add
key
=
CategoryTableDependencyvalue=Category/>
         <
add
key
=
ProductTableDependencyvalue=Product,Category/>
         <
add
key
=
ItemTableDependencyvalue=Product,Category,Item/>
         <!–
Order processing options (Asynch/Synch)
–>
         <
add
key
=
OrderStrategyAssemblyvalue=PetShop.BLL/>
         <
add
key
=
OrderStrategyClassvalue=PetShop.BLL.OrderSynchronous/>
         <!–
Asynchronous Order options
–>
         <
add
key
=
OrderMessagingvalue=PetShop.MSMQMessaging/>
         <
add
key
=
OrderQueuePathvalue=FormatName:DIRECT=OS:MachineName/Private$/PSOrders/>
         <!–
Application Error Log
–>
         <
add
key
=
Event Log Sourcevalue=.NET Pet Shop 4.0/>
     </
appSettings
>
     <
system.web
>
         <
pages
theme
=
PetShopstyleSheetTheme=PetShop/>
         <!–
            Set compilation debug=”true” to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
       
–>
         <
compilation
debug
=
false>
              <
assemblies
>
                   <
add
assembly
=
System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089/>
                   <
add
assembly
=
System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089/>
                   <
add
assembly
=
Accessibility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A/>
                   <
add
assembly
=
System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A/></assemblies></compilation>
         <!–
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        
–>
         <
authentication
mode
=
Forms>
              <
forms
name
=
PetShopAuthloginUrl=SignIn.aspxprotection=Nonetimeout=60/>
         </
authentication
>
         <!–
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.
       
–>
         <
customErrors
defaultRedirect
=
Error.aspxmode=RemoteOnly/>
         <
sessionState
mode
=
Off/>
         <
anonymousIdentification
enabled
=
true/>
         <
profile
automaticSaveEnabled
=
falsedefaultProvider=ShoppingCartProvider>
              <
providers
>
                   <
add
name
=
ShoppingCartProviderconnectionStringName=SQLProfileConnStringtype=PetShop.Profile.PetShopProfileProviderapplicationName=.NET Pet Shop 4.0/>
                   <
add
name
=
WishListProviderconnectionStringName=SQLProfileConnStringtype=PetShop.Profile.PetShopProfileProviderapplicationName=.NET Pet Shop 4.0/>
                   <
add
name
=
AccountInfoProviderconnectionStringName=SQLProfileConnStringtype=PetShop.Profile.PetShopProfileProviderapplicationName=.NET Pet Shop 4.0/>
              </
providers
>
              <
properties
>
                   <
add
name
=
ShoppingCarttype=PetShop.BLL.CartallowAnonymous=trueprovider=ShoppingCartProvider/>
                   <
add
name
=
WishListtype=PetShop.BLL.CartallowAnonymous=trueprovider=WishListProvider/>
                   <
add
name
=
AccountInfotype=PetShop.Model.AddressInfoallowAnonymous=falseprovider=AccountInfoProvider/>
              </
properties
>
         </
profile
>
         <!–
Membership Provider for SqlServer
–>
         <
membership
defaultProvider
=
SQLMembershipProvider>
              <
providers
>
                   <
add
name
=
SQLMembershipProvidertype=System.Web.Security.SqlMembershipProviderconnectionStringName=SQLMembershipConnStringapplicationName=.NET Pet Shop 4.0enablePasswordRetrieval=falseenablePasswordReset=truerequiresQuestionAndAnswer=falserequiresUniqueEmail=falsepasswordFormat=Hashed/>
              </
providers
>
         </
membership
>
         <!–
Membership Provider for Oracle
–>
         <!–
         <membership defaultProvider=”OracleMembershipProvider”>
              <providers>
                   <clear/>
                   <add name=”OracleMembershipProvider”
                       type=”PetShop.Membership.OracleMembershipProvider”
                       connectionStringName=”OraMembershipConnString”
                       enablePasswordRetrieval=”false”
                       enablePasswordReset=”false”
                       requiresUniqueEmail=”false”
                       requiresQuestionAndAnswer=”false”
                       minRequiredPasswordLength=”7″
                       minRequiredNonalphanumericCharacters=”1″
                       applicationName=”.NET Pet Shop 4.0″
                       hashAlgorithmType=”SHA1″
                       passwordFormat=”Hashed”/>
              </providers>
         </membership>
          
–>
         <
caching
>
              <
sqlCacheDependency
enabled
=
truepollTime=10000>
                   <
databases
>
                       <
add
name
=
MSPetShop4connectionStringName=SQLConnString1pollTime=10000/>
                   </
databases
>
              </
sqlCacheDependency
>
         </
caching
>
     </
system.web
>
     <
location
path
=
UserProfile.aspx>
         <
system.web
>
              <
authorization
>
                   <
deny
users
=
?/>
              </
authorization
>
         </
system.web
>
     </
location
>
     <
location
path
=
CheckOut.aspx>
         <
system.web
>
              <
authorization
>
                   <
deny
users
=
?/>
              </
authorization
>
         </
system.web
>
     </
location
>
</
configuration
>
 
 
 
/SQLServerDAL/Item.cs

IItem
的实现类)
using
System;
using
System.Data;
using
System.Data.SqlClient;
using
PetShop.Model;
using
PetShop.IDAL;
using
System.Collections.Generic;
using
PetShop.DBUtility;
 
namespace
PetShop.SQLServerDAL {
 
    public class Item : IItem {
 
        // Static constants
        private const string SQL_SELECT_ITEMS_BY_PRODUCT = “SELECT Item.ItemId, Item.Name, Inventory.Qty, Item.ListPrice, Product.Name, Item.Image, Product.CategoryId, Product.ProductId FROM Item INNER JOIN Product ON Item.ProductId = Product.ProductId INNER JOIN Inventory ON Item.ItemId = Inventory.ItemId WHERE Item.ProductId = @ProductId”;
       
        private const string SQL_SELECT_ITEM = “SELECT Item.ItemId, Item.Name, Item.ListPrice, Product.Name, Item.Image, Product.CategoryId, Product.ProductId FROM Item INNER JOIN Product ON Item.ProductId = Product.ProductId WHERE Item.ItemId = @ItemId”;
 
        private const string PARM_PRODUCT_ID = “@ProductId”;
        private const string PARM_ITEM_ID = “@ItemId”;
 
        ///<summary>
        /// Function to get a list of items within a product group
        ///</summary>
         ///<param name=”productId”>Product Id</param>      
        ///<returns>A Generic List of ItemInfo</returns>
         public IList<ItemInfo> GetItemsByProduct(string productId) {
 
            IList<ItemInfo> itemsByProduct = new List<ItemInfo>();
 
            SqlParameter parm = new SqlParameter(PARM_PRODUCT_ID, SqlDbType.VarChar, 10);
            parm.Value = productId;
 
            //Execute the query against the database
              using(SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_ITEMS_BY_PRODUCT, parm)) {
                // Scroll through the results
                while (rdr.Read()) {
                    ItemInfo item = new ItemInfo(rdr.GetString(0), rdr.GetString(1), rdr.GetInt32(2), rdr.GetDecimal(3), rdr.GetString(4), rdr.GetString(5), rdr.GetString(6), rdr.GetString(7));
                    //Add each item to the arraylist
                    itemsByProduct.Add(item);
                }
            }
            return itemsByProduct;
        }
 
 
        ///<summary>
        /// Get an individual item based on a unique key
        ///</summary>
        ///<param name=”itemId”>unique key</param>
        ///<returns>Details about the Item</returns>
        public ItemInfo GetItem(string itemId) {
 
            //Set up a return value
            ItemInfo item = null;
 
            //Create a parameter
            SqlParameter parm = new SqlParameter(PARM_ITEM_ID, SqlDbType.VarChar, 10);
            //Bind the parameter
            parm.Value = itemId;
 
            //Execute the query 
            using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SQL_SELECT_ITEM, parm)) {
                if (rdr.Read())
                    item = new ItemInfo(rdr.GetString(0), rdr.GetString(1), 0, rdr.GetDecimal(2), rdr.GetString(3), rdr.GetString(4), rdr.GetString(5), rdr.GetString(6));
                else
                    item = new ItemInfo();
            }
            return item;
        }
 
        ///<summary>
        /// Get the SqlCommand used to retrieve a list of items by product
        ///</summary>
        ///<param name=”id”>Product id</param>
        ///<returns>Sql Command object used to retrieve the data</returns>
        public static SqlCommand GetCommand(string id) {
 
            //Create a parameter
            SqlParameter parm = new SqlParameter(PARM_PRODUCT_ID, SqlDbType.VarChar, 10);
            parm.Value = id;
 
            // Create and return SqlCommand object
            SqlCommand command = new SqlCommand(SQL_SELECT_ITEMS_BY_PRODUCT);
            command.Parameters.Add(parm);
            return command;
        }
    }
}
 
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/183389.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

  • 大公司里怎样开发和部署前端代码[通俗易懂]

    大公司里怎样开发和部署前端代码[通俗易懂]这是一个非常有趣的非主流前端领域,这个领域要探索的是如何用工程手段解决前端开发和部署优化的综合问题,入行到现在一直在学习和实践中。在我的印象中,facebook是这个领域的鼻祖,有兴趣、有梯子的同学可以去看看facebook的页面源代码,体会一下什么叫工程化。接下来,我想从原理展开讲述,多图,较长,希望能有耐心看完。原文https://github.com/fouber/blog

  • archwing任务流程_机器的武器任务流程

    archwing任务流程_机器的武器任务流程有两台机器 A,B 以及 K 个任务。机器 A 有 N 种不同的模式(模式 0∼N−1),机器 B 有 M 种不同的模式(模式 0∼M−1)。两台机器最开始都处于模式 0。每个任务既可以在 A 上执行,也可以在 B 上执行。对于每个任务 i,给定两个整数 a[i] 和 b[i],表示如果该任务在 A 上执行,需要设置模式为 a[i],如果在 B 上执行,需要模式为 b[i]。任务可以以任意顺序被执行,但每台机器转换一次模式就要重启一次。求怎样分配任务并合理安排顺序,能使机器重启次数最少。输入格

  • mysql autoconf_autoconf手册(一)

    mysql autoconf_autoconf手册(一)AutoconfCreatingAutomaticConfigurationScriptsEdition2.13,forAutoconfversion2.13December1998byDavidMacKenzieandBenElliston—————————————————————–…

  • kali不能使用arpspoof命令_kali不能使用arpspoof命令_ARP欺骗工具arpspoof的用法「建议收藏」

    kali不能使用arpspoof命令_kali不能使用arpspoof命令_ARP欺骗工具arpspoof的用法「建议收藏」arpspoof是一个好用的ARP欺骗工具,Kalilinux中自带了该工具,在ubuntu中,安装它只需运行命令:sudoapt-getinstalldsniff安装完成后,输入命令:manarpspoof可以查看使用手册,2.4版本的手册内容如下(自己翻译的,非官方):名字arpspoof-截获交换局域网中的数据包用法arpspoof[-iinterface][-cow…

  • 级数敛散性

    级数敛散性

  • visdom 使用教程

    visdom 使用教程visdom教程visdom安装与启动服务visdom常用功能image窗口:图像显示与更新窗口显示images窗口:多个图像显示与更新窗口显示text窗口:显示文本与更新文本line窗口:绘制折线图与更新折线图scatter窗口:绘制散点图与更新散点图visdom安装与启动服务安装visdompipinstallvisdom打开服务python-mvisdom.server…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号