Exemple #1
0
        static void Main(string[] args)
        {
            //test();

            Console.WriteLine("");
            Console.WriteLine("CustomProxy Sample");
            Console.WriteLine("================");
            Console.WriteLine("");
            // Create an instance of MyProxy.
            DynamicProxy myProxyInstance = new DynamicProxy(typeof(Cicada));
            // Get a CustomServer proxy.
            IAnimal myHelloServer = (Cicada)myProxyInstance.GetTransparentProxy();

            // Get stubdata.
            Console.WriteLine("GetStubData = " + RealProxy.GetStubData(myProxyInstance).ToString());
            // Get ProxyType.
            Console.WriteLine("Type of object represented by RealProxy is :"
                              + myProxyInstance.GetProxiedType());
            //myHelloServer.HelloMethod("RealProxy Sample");
            myHelloServer.Eating();
            //Console.WriteLine("");
            // Get a reference object from server.
            //Console.WriteLine("Create an objRef object to be marshalled across Application Domains...");
            //ObjRef CustomObjRef = myProxyInstance.CreateObjRef(typeof(CustomServer));
            //Console.WriteLine("URI of 'ObjRef' object =  " + CustomObjRef.URI);
        }
Exemple #2
0
        public static void Main()
        {
            IAnimal      animal       = null;
            DynamicProxy dynamicProxy = new DynamicProxy(typeof(Cicada));

            animal = (IAnimal)(dynamicProxy.GetTransparentProxy());
            animal.Eating();
            //Assert.Pass();
        }
Exemple #3
0
        public static void test()
        {
            IAnimal      animal       = null;
            DynamicProxy dynamicProxy = new DynamicProxy(typeof(Cicada));

            animal = (IAnimal)(dynamicProxy.GetTransparentProxy());
            // Get stubdata.
            Console.WriteLine("GetStubData = " + RealProxy.GetStubData(dynamicProxy).ToString());

            animal.Eating();
            //Assert.Pass();
        }