2
How the 3 life cycles of a dependency injection works such as Singleton, Transient and Scope ?
2
How the 3 life cycles of a dependency injection works such as Singleton, Transient and Scope ?
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 found item that has such a dependency, that is, if there are 5 dependencies there will be 5 different instances
scoped : this one different from Transient that ensures that in a request an instance of a class is created where if there are other dependencies, be used this single instance for all, renewing only in the subsequent requests, but, maintaining this obligation.
Browser other questions tagged java c# asp.net-mvc dependency-injection
You are not signed in. Login or sign up in order to post.
Eduardo after all what is the difference between scoped and Transient? so I understood the object of the service is created for each request?
– Thiago Loureiro
@Thiagoloureiro found a better definition
– Eduardo Sampaio
Now yes! + 1! Thanks for the clarification!
– Thiago Loureiro