示例#1
0
        static void Main(string[] args)
        {
            // Use db.
            IProductService productService = new ProductService();

            PrintProducts(productService.GetAll());

            // First appeal to the db.
            productService = new ProductServiceProxy(productService);
            PrintProducts(productService.GetAll());

            // Now appeal to the RAM.
            PrintProducts(productService.GetAll());

            // same with GetById...

            Console.ReadLine();
        }
        public static void Execute()
        {
            string username = "******";

            //Proxy requires the username whereas the Productservice doesn't

            ProductServiceProxy service = new ProductServiceProxy(username);

            service.AddProduct();
            service.GetAll();
            service.GetProduct();
        }