DEV Community

hdemiray
hdemiray

Posted on

IoC (Inversion of Control) Container

Nedir ? Dependency inversion uygularken kullandığımız dependency injection tasarım dilinde bir interface örneği istenirse ona somut olan sınıftan verir arkada örneğini tutar(new) ve yaşam döngüsünü tutar tek seferlikmi çalışacak (singelton) her seferinde yeniden mi oluşturulacak gibi.

Bu kontrol araçlarına örnek olarak

Ninject, Unity(Microsoft), Castle Windsow, Structure Map.
Dry IoC , LightInject

Nasıl Kullanılır projeye eklenir.(Ninject)

Bunlar farklı dosyalardaki farklı configurasyonlar olarak düşünelim.

Katmanlar arası geçişte singleton kullanıyoruz

 

kernel.Bind<IMevzuat>().To<IkinciMevzuat>().SingletonScope(); 

CustomerManager CustomerManager=new CustomerManager(kernel.Get<IMevzuat>());
CustomerManager.Add();
Enter fullscreen mode Exit fullscreen mode

Kernel bir kutu gibidir ona koyduğumuzu isteyen heryere dağıtır tek
Noktadan kontrol imkanı sunar. 

DevCycle image

Ship Faster, Stay Flexible.

DevCycle is the first feature flag platform with OpenFeature built-in to every open source SDK, designed to help developers ship faster while avoiding vendor-lock in.

Start shipping

Top comments (0)

Dev Diairies image

User Feedback & The Pivot That Saved The Project

🔥 Check out Episode 3 of Dev Diairies, following a successful Hackathon project turned startup.

Watch full video 🎥

👋 Kindness is contagious

Delve into this thought-provoking piece, celebrated by the DEV Community. Coders from every walk are invited to share their insights and strengthen our collective intelligence.

A heartfelt “thank you” can transform someone’s day—leave yours in the comments!

On DEV, knowledge sharing paves our journey and forges strong connections. Found this helpful? A simple thanks to the author means so much.

Get Started