Ejemplo n.º 1
0
 public void Request()
 {
     if (CheckAccess())
     {
         if (realSubject == null)
         {
             realSubject = new RealSubject();
         }
         realSubject.Request();
         LogAccess();
     }
 }
Ejemplo n.º 2
0
        public void Run()
        {
            Console.WriteLine("Client: Executing the client code with a real subject:");
            var realSubject = new RealSubject();

            ClientCode(realSubject);

            Console.WriteLine();

            Console.WriteLine("Client: Executing the same client code with a proxy:");
            var proxy = new Proxy(realSubject);

            ClientCode(proxy);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Client client = new Client();

            Console.WriteLine("Client: Executing the client code with a real subject:");
            RealSubject realSubject = new RealSubject();

            client.ClientCode(realSubject);

            Console.WriteLine();

            Console.WriteLine("Client: Executing the same client code with a proxy:");
            Proxy proxy = new Proxy(realSubject);

            client.ClientCode(proxy);
        }
Ejemplo n.º 4
0
 public Proxy(RealSubject realSubject)
 {
     this.realSubject = realSubject;
 }