Request() public method

public Request ( ) : void
return void
コード例 #1
0
 public override void Request()
 {
     if (realsubject == null)
     {
         realsubject = new RealSubject();
     }
     realsubject.Request();
 }
コード例 #2
0
 public override string Request()
 {
     if (realSubject == null)
     {
         realSubject = new RealSubject();
     }
     return(realSubject.Request());
 }
コード例 #3
0
 public override void Request()
 {
     if (_realSubject == null)
     {
         _realSubject = new RealSubject();
     }
     _realSubject.Request();
 }
コード例 #4
0
 public void Request()
 {
     if (RealSubject == null)
     {
         RealSubject = new RealSubject(this.Data); // Here you could get the data from the database, for example.
     }
     RealSubject.Request();
 }
コード例 #5
0
 //The most common applications of the Proxy pattern are lazy loading, caching, controlling the access, logging, etc.
 //A Proxy can perform on of these things and then, depending on the result, pass the execution to the same method
 //in a linked RealSubject object.
 public void Request()
 {
     if (CheckAccess())
     {
         _realSubject.Request();
         LogAccess();
     }
 }
コード例 #6
0
 public override void Request()
 {
     //use lazy initialization
     if (_realSubject == null)
     {
         _realSubject = new RealSubject();
     }
     _realSubject.Request();
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: azb101/design-patterns
        static void Main(string[] args)
        {
            // canonical
            var subject = new RealSubject();

            subject.Request();

            var proxy = new Proxy.Canonical.Proxy();

            proxy.Request();

            // live
            Console.WriteLine();

            var image = new ProxyImage("C://temp.jpq");

            // will be loaded lazyly
            image.Display();

            // wont be loaded 2nd time
            image.Display();
        }
コード例 #8
0
 public override void Request()
 {
     //实例一个真实用户
     realSubject = new RealSubject();
     realSubject.Request();//调用真实用户的方法
 }