コード例 #1
0
        public IActionResult Get()
        {
            var productService = TransparentProxy <IProductService> .Create(new ProductManager(_memoryCache), _memoryCache);

            var result = productService.GetProductList();

            return(Ok(result));
        }
コード例 #2
0
        public IActionResult Post([FromBody] ProductItemDto productItemDto)
        {
            var productService = TransparentProxy <IProductService> .Create(new ProductManager(_memoryCache), _memoryCache);

            productService.AddProduct(productItemDto);

            return(Created(string.Empty, true));
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: l5071134/AopSolutions
        private static void TestProxy()
        {
            ISimpleService svc = TransparentProxy.Create(new ProxyService());

            svc.Execute();
            var rst = svc.GetResult();

            Console.WriteLine("执行结果为:" + rst);
        }
コード例 #4
0
ファイル: Proxy.cs プロジェクト: 1244952898/CSharp
        public static void Show()
        {
            User user = new User()
            {
                Name = "Eleven", Password = "******"
            };

            //UserProcessor processor = new UserProcessor();

            UserProcessor userprocessor = TransparentProxy.Create <UserProcessor>();

            userprocessor.RegUser(user);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: l5071134/AopSolutions
        private static void TesAoptProxy()
        {
            ISimpleService _svc  = TransparentProxy.Create(new ProxyService());
            var            build = new ContainerBuilder();

            build.Register((c) => TransparentProxy.Create(new ProxyService())).As <ISimpleService>().InstancePerLifetimeScope();
            var container = build.Build();
            var svc       = container.Resolve <ISimpleService>();

            svc.Execute();
            var rst = svc.GetResult();

            Console.WriteLine("执行结果为:" + rst);
        }
コード例 #6
0
        public static void Show()
        {
            User user = new User()
            {
                Name = "Eleven", Password = "******"
            };

            UserProcessor processor = new UserProcessor();

            processor.RegUser(user);

            Console.WriteLine("*********************");
            UserProcessor userProcessor = TransparentProxy.Create <UserProcessor>();

            userProcessor.RegUser(user);
        }
コード例 #7
0
 public ITravelService Create()
 {
     return(TransparentProxy <ITravelService> .Create(new TravelService()));
 }