예제 #1
0
        private static void AuthenticationProxyLogging()
        {
            Console.WriteLine("***\r\n AuthenticationProxyLogging Loglama program başladı \r\n");
            Console.WriteLine("\r\nadmin olarak çalışıyor");
            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("Administrator"), new[] { "ADMIN" });
            IRepository <Customer> customerRepository =
                RepositoryFactory.CreateAuthenticationProxy <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\nnormal kullanıcı olarak çalışıyor");
            Thread.CurrentPrincipal =
                new GenericPrincipal(new GenericIdentity("NormalUser"),
                                     new string[] { });
            customerRepository.Add(customer);
            customerRepository.Update(customer);
            customerRepository.Delete(customer);
            Console.WriteLine("\r\n AuthenticationProxyLogging Loglama program bitti \r\n***");
            Console.ReadLine();
        }