示例#1
0
        static void Main(string[] args)
        {
            #region 第一步
            //OrderModel orderModel = new OrderModel();

            //IOrderProcessorProxy orderProcessor = new OrderProcessorProxyLog(new ProductOrderProcessor());

            //orderProcessor = new OrderProcessorProxyAuthentication(orderProcessor);
            //orderProcessor.Submit(orderModel);

            #endregion

            #region 第二步

            //IOrderProcessorProxy orderProcessor = OrderProcessorProxyFactory.CreateOrderProcessorProxy(OrderProcessorProxyType.Recharge);

            IOrderProcessorProxy orderProcessor = OrderProcessorProxyFactory.CreateOrderProcessorProxyConfjg();

            OrderModel orderModel = new OrderModel();
            orderProcessor.Submit(orderModel);

            #endregion

            Console.ReadLine();
        }
示例#2
0
        public static IOrderProcessorProxy CreateOrderProcessorProxyConfjg()
        {
            Assembly             assembly            = Assembly.Load(DllName);
            IOrderProcessorProxy orderProcessorProxy = assembly.CreateInstance(OrderProcessorProxyName) as IOrderProcessorProxy;

            orderProcessorProxy = new OrderProcessorProxyLog(orderProcessorProxy);
            orderProcessorProxy = new OrderProcessorProxyAuthentication(orderProcessorProxy);

            return(orderProcessorProxy);
        }
示例#3
0
        public static IOrderProcessorProxy CreateOrderProcessorProxy(OrderProcessorProxyType processorProxyType)
        {
            IOrderProcessorProxy orderProcessorProxy = null;

            switch (processorProxyType)
            {
            case OrderProcessorProxyType.Product:
                orderProcessorProxy = new ProductOrderProcessor();
                break;

            case OrderProcessorProxyType.Recharge:
                orderProcessorProxy = new RechargeOrderProcessor();
                break;

            default:
                throw new Exception("没有找到订单类型");
            }
            orderProcessorProxy = new OrderProcessorProxyLog(orderProcessorProxy);
            orderProcessorProxy = new OrderProcessorProxyAuthentication(orderProcessorProxy);
            return(orderProcessorProxy);
        }
 public OrderProcessorProxyAuthentication(IOrderProcessorProxy decorated)
 {
     _decorated = decorated;
 }
示例#5
0
 public OrderProcessorProxyLog(IOrderProcessorProxy decorated)
 {
     _decorated = decorated;
 }