Why should I use Dependency Injection?

Dependency Injection (DI): In what scenarios do we need to use the unity framework, in which not?

  • c#,unity 2.0,modularity,programming Related question:

  • Answer:

    Unity is light-weight DI container with good performance. This is helpful component-based software designing. TI follows OO principles. You can create It provides simplicity, flexibility with run time configuration capabilities, can leverage, constructor, method, property call injection features. You can implement hierarichal dependencies, manage complex hierarchies. You can read more at  http://www.codeproject.com/Articles/254091/Implementing-Microsoft-Unity-Design-Pattern

Anuradha Katiyar at Quora Visit the source

Was this solution helpful to you?

Other answers

You only need to use a DI container/framework in cases where you're letting something else control the lifecycle of your objects. You never, ever *need* to use a DI container/framework in cases where you retain total control over the lifecycle of your objects. In other words, as long as you keep control of when to call "new", you never need a DI container. Don't use a container/framework until something forces (really forces) you to do it. Reference: "Refactor Your Way to a Dependency Injection Container" http://blog.thecodewhisperer.com/2011/12/07/refactor-your-way-to-a-dependency-injection-container

J. B. Rainsberger

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.