Ejemplo n.º 1
0
        public static void TestAOP()
        {
            IMyContainerV2 container = new MyContainerV2();

            container.AddTransient <IMethodService, MethodService>();
            container.AddTransient <IPropertyService, PropertyService>();

            IMethodService   m = container.Resolve <IMethodService>();   // EProxy
            IPropertyService p = container.Resolve <IPropertyService>(); // FProxy

            m.Show();
            Console.WriteLine();
            p.Show();
        }
Ejemplo n.º 2
0
        public static void RunInterface()
        {
            ProxyGenerator       generator   = new ProxyGenerator();
            MyExampleInterceptor interceptor = new MyExampleInterceptor();

            IMyContainerV2 container = new MyContainerV2();

            container.AddTransient <IMethodService, MethodService>();
            IMethodService service = container.Resolve <IMethodService>();

            service.Show();

            Console.WriteLine();

            var proxy = generator.CreateInterfaceProxyWithTarget(service, interceptor);

            proxy.Show();
        }