Dependency Injection

Definition of of Dependency Injection and Which Types Are Availble

Dependency Injection DI Wednesday, May 21, 2014

Concisely, dependency injection is a design pattern that allows the class dependencies to be created by something outside of its control and passed to it (which applies the Dependency Inversion of Control). That "something" is also supposed to control the lifetime of those dependencies.

The patterns used to pass those dependencies created outside the class are as follows:

  1. Constructor Injection
  2. Property Injection
  3. Method Injection
  4. Ambient Context