Thursday, 21 December 2017

Memory Jogger for Me - Object Lifetime Management...

Lifestyle
Description
Disposal
A new instance of the component will be created each time the service is requested from the container. If multiple consumers depend on the service within the same graph, each consumer will get its own new instance of the given service.
Never
For every request within an implicitly or explicitly defined scope.
Instances will be disposed when their scope ends.
There will be at most one instance of the registered service type and the container will hold on to that instance until the container is disposed or goes out of scope. Clients will always receive that same instance from the container.
Instances will be disposed when the container is disposed.


Lifestyle
Description
Disposal
Within a certain (explicitly defined) scope, there will be only one instance of a given service type A created scope is specific to one particular thread, and can’t be moved across threads.
Instance will be disposed when their scope gets disposed.
There will be only one instance of a given service type within a certain (explicitly defined) scope. This scope will automatically flow with the logical flow of control of asynchronous methods.
Instance will be disposed when their scope gets disposed.
Only one instance will be created by the container per web request. Use this lifestyle in ASP.NET Web Forms and ASP.NET MVC applications.
Instances will be disposed when the web request ends.
Only one instance will be created by the container during the lifetime of the WCF service class.
Instances will be disposed when the WCF service class is released.


No comments:

Post a Comment