凌寒飘香

____成风破浪会有时,直把云帆济沧海!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::
微软宠物店的分析

//---------页面表现层Web----------------------
Product product = new Product();
IList productsByCategory = product.GetProductsByCategory((string)ViewState[KEY_CATEGORY]);

 

//----------业务逻辑层---------------------
namespace PetShop.BLL
public class Product


IProduct dal = PetShop.DALFactory.Product.Create(); 
return dal.GetProductsBySearch(keywords);
}


//---------接口层--------------------------
namespace PetShop.IDAL

{

public interface IProduct


  IList GetProductsByCategory(string category); 
  }
}

//------------数据访问层--------------------
public class Product : IProduct

{
public IList GetProductsByCategory(string category) {
}
}

 

//----------静态工厂方法--------------------
namespace PetShop.DALFactory

 {
public class Product

{
public static PetShop.IDAL.IProduct Create()

{
string path = System.Configuration.ConfigurationSettings.AppSettings["WebDAL"];
string className = path + ".Product";
return (PetShop.IDAL.IProduct)Assembly.Load(path).CreateInstance(className);
  }
 }
}

 


posted on 2010-02-11 11:45  凌寒飘香  阅读(325)  评论(0编辑  收藏  举报