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(); }
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); }
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; }
public OrderProcessorProxyLog(IOrderProcessorProxy decorated) { _decorated = decorated; }