What is Dependency Injection
Dependency Injection implies sending a dependency into a dependent object as opposed to the dependent object controlling life cycle of its dependencies. It uses a builder object to initialize objects and provide the required dependencies to the object which allows to inject a dependency from outside the class.It is a software design pattern that allow us to develop loosely coupled code
- Helps to develop loosely coupled code
- Reduce tight coupling between software components
- Maintainable code
- Unit Testing
For specific to DI in MVC , please refer Sheo Sir's article at DNF :
What is Unity IOC Container
It is a lightweight DI container for building loosely coupled application that supports constructor injection, property injection, and method call injection.
- Easy to create hierarchical object structures and dependencies.
- Support for runtime dependencies.
- Can be easily configured.
- Containers can be cached at the client end.
Please refer to this article as how to use Unity IOC Container in Asp.net MVC : http://www.dotnet-tricks.com/Tutorial/dependencyinjection/632V140413-Dependency-Injection-in-ASP.NET-MVC-4-using-Unity-IoC-Container.html
Hope it helpsKumarkrishna184, if this helps please login to Mark As Answer. | Alert Moderator