微软宠物店的分析

---------页面表现层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);
  }
 }
}

相关文章:

  • 2021-12-01
  • 2022-12-23
  • 2021-05-05
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
相关资源
相似解决方案