Esempio n. 1
0
 static void Access(Subject subject)
 {
     subject.Read();
     subject.Create();
     subject.Update();
     subject.Delete();
 }
Esempio n. 2
0
        static void TryAccess(Subject proxy, string name)
        {
            try
            {
                proxy.Create(name, "TestValue");
                Console.WriteLine("Create - OK!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                proxy.Read("TestKey");
                Console.WriteLine("Read - OK!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                proxy.Update(name, "NewTestValue");
                Console.WriteLine("Update - OK!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                proxy.Delete(name);
                Console.WriteLine("Delete - OK!");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.WriteLine(new string('-', 50));
        }