public void toApply(CreditManager cm, List <LoggerService> loggerServices)
 {
     cm.Calculate();
     foreach (var log in loggerServices)
     {
         log.Log();
     }
 }
 public override int Calculate()
 {
     if (_creditManager == null)
     {
         _creditManager = new CreditManager();
         _cachedValue   = _creditManager.Calculate();
     }
     return(_cachedValue);
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            int sayi1 = 10;
            int sayi2 = 20;

            sayi1 = sayi2;
            sayi2 = 100;
            Console.WriteLine(sayi1);

            int[] sayilar  = new[] { 1, 2, 3 };
            int[] sayilar2 = new[] { 10, 22, 33 };
            sayilar = sayilar2;

            sayilar2[0] = 100;

            Console.WriteLine(sayilar[1]);


            CreditManager creditManager = new CreditManager();
            Customer      customer      = new Customer();

            CustomerManager customerManager = new CustomerManager(customer); //örnek olusturma instance alma


            Compony compony = new Compony();

            compony.Id = 100;
            Person person = new Person();

            customer.Id             = 1;
            customer.FirstName      = "Kubilay";
            customer.LastName       = "Yazı";
            person.NationalIdentity = "11111111111";

            CustomerManager customerManager2 = new CustomerManager(new Compony());

            customerManager.Save();

            creditManager.Calculate();

            customerManager.Save();
            customerManager.Delete();
            Console.ReadKey();
        }
 //Dependency Injection
 //Method Injection
 public void Apply(CreditManager creditManager, ILoggerService loggerService)
 {
     creditManager.Calculate();
     loggerService.Log();
 }