Exemple #1
0
 /// <summary>
 /// 代理或转发请求
 /// </summary>
 public void Request()
 {
     PreRequest();
     if (realSubject == null)
         realSubject = new RealSubject();
     realSubject.Request();//代理转发
     PostRequest();
 }
Exemple #2
0
        public static void Test()
        {
            Console.WriteLine("==============================Proxy Test==================================");

            //使用代理
            Subject proxySubject = new ProxySubject();
            proxySubject.Request();

            //不使用代理
            Subject realSubject = new RealSubject();
            realSubject.Request();
        }