Exemple #1
0
        public static void Test1()
        {
            ProxyGenerator        generator   = new ProxyGenerator();
            CallingLogInterceptor interceptor = new CallingLogInterceptor();
            SimpleSamepleEntity   entity      = generator.CreateClassProxy <SimpleSamepleEntity>(interceptor);

            entity.Name = "Richie";
            entity.Age  = 50;
            Console.WriteLine("The entity is: " + entity);
            Console.WriteLine("Type of the entity: " + entity.GetType().FullName);
            Console.ReadKey();
        }
Exemple #2
0
        public static void Test3()
        {
            ProxyGenerator generator = new ProxyGenerator();
            var            options   = new ProxyGenerationOptions(new InterceptorFilter())
            {
                Selector = new InterceptorSelector()
            };
            SimpleSamepleEntity entity = generator.CreateClassProxy <SimpleSamepleEntity>(
                options,
                new SimpleLogInterceptor(), new CallingLogInterceptor());

            entity.Name = "Richie";
            entity.Age  = 50;
            Console.WriteLine("The entity is: " + entity);
            Console.WriteLine("Type of the entity: " + entity.GetType().FullName);
            Console.ReadKey();
        }