What is Dependency Injection / Inversion of control?
Nilesh Shah
Inversion of control is concept where control to create object is given to some other function. Simple example is : If we have customer class and for logging we have used Log class in it. As Logging is not related to customer functionality so creation of its object or where we should log should not be determined by customer class. That should be taken care outside customer class. That is called inversion of control. Using Dependency injection we implement Inversion of control.
Kindly visit below linkhttps://www.codeproject.com/Articles/592372/Dependency-Injection-DI-vs-Inversion-of-Control-IO
The Dependency Inversion principle helps us to develop loosely couple code by ensuring that high-level modules depend on abstractions rather than concrete implementations of lower-level modules. The Inversion of Control pattern is an implementation of this principle.
Ioc means delegating responsibility of creating instances to some other framework. Dependency Injection is the method by which we accomplish Inversion of control. There are so many IoC containers available like Microsoft Unity,StructureMap,WindsorCastle etc. It really helps in building unit testable applications that are easy to maintain and adaptable to any change and manageable.
System.Web.Mvc.DependencyResolver.Current.GetServiceit will resolve dependancy. One class dependence on other class object.