Exemple #1
0
        static void Main(string[] args)
        {
            B b = new B();

            b.Test();
            ///Example 1 test
            //Iterator<int> iterator = new Lesson2.SafeCollections.NaturalList();
            //Iterator<int> iterator = new Filter<int>(new Lesson2.SafeCollections.NaturalList(), value => value % 2 == 0);
            Iterator <string> iterator = new Map <int, string>(new Filter <int>(new Lesson2.SafeCollections.NaturalList(), value => value % 2 == 0), elem => elem + " :)");

            for (int i = 0; i < 10; i++)
            {
                iterator.GetNext().Visit <object>(() => { Console.WriteLine("Done"); return(null); }, v => { Console.WriteLine(v); return(null); });
            }

            ///Example 2 test
            Console.WriteLine("***\r\nBegin program\r\n");

            //IRepository<Customer> customerRepository = new Repository<Customer>();
            IRepository <Customer> customerRepository = new LoggerRepository <Customer>(new Repository <Customer>());

            var customer = new Customer
            {
                Id      = 1,
                Name    = "Customer 1",
                Address = "Address 1"
            };

            customerRepository.Add(customer);
            customerRepository.Update(customer);
            customerRepository.Delete(customer);

            Console.WriteLine("\r\nEnd program \r\n***");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("***\r\nBegin program - WITH logging\r\n");
            IRepository<Customer> customerRepo = new Repo<Customer>();
            IRepository<Customer> loggerRepo = new LoggerRepository<Customer>(customerRepo);

            var customer = new Customer { Id = 1, Name = "Tero Testaaja", Address = "Testikatu 1" };
            loggerRepo.Add(customer);
            loggerRepo.Update(customer);
            loggerRepo.Delete(customer);

            Console.WriteLine("\r\nEnd program - WITH logging\r\n***");
            Console.ReadLine();
        }
 private static void OneDecoratorNoProxy()
 {
     Console.WriteLine("***\r\n Begin program - logging with decorator\r\n");
     IRepository<Customer> customerRepository =
       new LoggerRepository<Customer>(new Repository<Customer>());
     var customer = new Customer
     {
         Id = 1,
         Name = "Customer 1",
         Address = "Address 1"
     };
     customerRepository.Add(customer);
     customerRepository.Delete(customer);
     Console.WriteLine("\r\nEnd program - logging with decorator\r\n***");
     Console.ReadLine();
 }
        public void TestAOP_RealProxy_Logging_With_Decorator()
        {
            Console.WriteLine("***\r\n Begin program - logging with decorator\r\n");

            IRepository <Customer> customerRepository = new LoggerRepository <Customer>(new Repository <Customer>());
            var customer = new Customer
            {
                Id      = 1,
                Name    = "Customer 1",
                Address = "Address 1"
            };

            customerRepository.Add(customer);
            customerRepository.Update(customer);
            customerRepository.Delete(customer);
            Console.WriteLine("\r\nEnd program - logging with decorator\r\n***");
        }
Exemple #5
0
        private static void SimpleMethodLogging()
        {
            Console.WriteLine("***\r\n SimpleMethodLogging Loglama program başladı \r\n");
            IRepository <Customer> customerRepository =
                new LoggerRepository <Customer>(new Repository <Customer>());
            var customer = new Customer
            {
                Id      = 1,
                Name    = "Müşteri 1",
                Address = "Adres 1"
            };

            customerRepository.Add(customer);
            customerRepository.Update(customer);
            customerRepository.Delete(customer);
            Console.WriteLine("\r\n SimpleMethodLogging Loglama program bitti \r\n***");
            Console.ReadLine();
        }