예제 #1
0
        static void Main(string[] args)
        {
            OrderModel orderModel = new OrderModel();

            ProductOrderProcessor orderProcessor = new ProductOrderProcessor();


            #region 第一步
            //orderProcessor.Submit(orderModel);
            #endregion

            #region 第二步
            //Console.WriteLine("提交订单前的日志逻辑");
            //orderProcessor.Submit(orderModel);
            //Console.WriteLine("提交订单后的日志逻辑");
            #endregion

            #region 第三步
            //包一层
            //ProductOrderProcessorProxy(orderProcessor, orderModel);

            OrderProcessorProxyLog productOrderProcessor = new OrderProcessorProxyLog(orderProcessor);

            productOrderProcessor.SubmitAndLog(orderModel);

            #endregion  AOP 的思想讲完了

            #region 第四步
            // 优化

            #endregion

            Console.ReadLine();
        }
예제 #2
0
 public OrderProcessorProxyLog(ProductOrderProcessor productOrderProcessor)
 {
     _productOrderProcessor = productOrderProcessor;
 }