コード例 #1
0
        public Decorate()
        {
            Console.WriteLine("****decorate****");
            People people = new People()
            {
                Id   = 1,
                Name = "decorate",
                Age  = 12
            };

            IDecorate decorate = new Decorates();

            decorate.Exec(people);

            decorate = new DecDecorate(decorate);
            decorate.Exec(people);
        }
コード例 #2
0
        public castleDynamicProxy()
        {
            Console.WriteLine("****castleDynamicProxy****");
            People people = new People()
            {
                Id   = 1,
                Name = "castleDynamicProxy",
                Age  = 12
            };

            ProxyGenerator generator = new ProxyGenerator();

            MyIntercepter intercepter = new MyIntercepter();
            Decorates     decorates   = generator.CreateClassProxy <Decorates>(intercepter);

            decorates.Exec(people);
        }