lifz

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

using System;
using System.EnterpriseServices;
using System.Reflection;
using System.Configuration;

namespace PetShop.DALFactory {
 
 /// <summary>
 /// Factory implementaion for the Order DAL object
 /// </summary>
 public class Order {

  //public static PetShop.IDAL.IOrder GetOrder() {
  public static PetShop.IDAL.IOrder Create() {

   /// Look up the DAL implementation we should be using
   string path = System.Configuration.ConfigurationSettings.AppSettings["OrdersDAL"];
   string className = path + ".Order";

   // Using the evidence given in the config file load the appropriate assembly and class
   return (PetShop.IDAL.IOrder)Assembly.Load(path).CreateInstance(className); 
  }
 }
}

posted on 2005-08-31 11:38  lifz  阅读(210)  评论(0)    收藏  举报