public IActionResult Get() { var productService = TransparentProxy <IProductService> .Create(new ProductManager(_memoryCache), _memoryCache); var result = productService.GetProductList(); return(Ok(result)); }
public IActionResult Post([FromBody] ProductItemDto productItemDto) { var productService = TransparentProxy <IProductService> .Create(new ProductManager(_memoryCache), _memoryCache); productService.AddProduct(productItemDto); return(Created(string.Empty, true)); }
private static void TestProxy() { ISimpleService svc = TransparentProxy.Create(new ProxyService()); svc.Execute(); var rst = svc.GetResult(); Console.WriteLine("执行结果为:" + rst); }
public static void Show() { User user = new User() { Name = "Eleven", Password = "******" }; //UserProcessor processor = new UserProcessor(); UserProcessor userprocessor = TransparentProxy.Create <UserProcessor>(); userprocessor.RegUser(user); }
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); }
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); }
public ITravelService Create() { return(TransparentProxy <ITravelService> .Create(new TravelService())); }