How does the life cycle dependency injection work?

2

How does the 3 life cycles of a dependency injection work such as singleton, transient and scope?

    
asked by anonymous 13.12.2017 / 23:22

1 answer

2

Singleton: A service object is created and provided for all requests. Thus, all requests get the same object;

Transient: will always generate a new instance for each item found that has such a dependency, ie if there are 5 dependencies, 5 different instances will be

scoped: this is different from Transient, which guarantees that in a request an instance of a class is created where there are other dependencies, this single instance is used for all, renewing only on subsequent requests, but maintaining this requirement. p>     

14.12.2017 / 11:26