parent
58db4ba8e7
commit
40e5e66fc2
1 changed files with 17 additions and 1 deletions
@ -1 +1,17 @@ |
|||||||
There are multiple Lifestyles available. |
There are multiple lifestyles available. These are needed for the registration of your classes. Depending on their lifestyle it is decided which instance is returned once you resolve it. |
||||||
|
|
||||||
|
The following documentation is supposed to help you decide, which `Lifestyle` you want to use for your need. |
||||||
|
The lifestyles are part of the enum `Lifestyle`. |
||||||
|
|
||||||
|
## `Lifestyle.Transient` |
||||||
|
|
||||||
|
Using the `Transient`-Lifestyle, a new instance gets created every time an instance is resolved. |
||||||
|
`Transient` instances are not tracked by the `IocContainer`, so once you don't need them anymore they can be claimed by the garbage collector without leaking memory. |
||||||
|
This is the default `Lifestyle` that the [[`RegistrationFactory`|RegistrationFactory]] uses. |
||||||
|
|
||||||
|
## `Lifestyle.Singleton` |
||||||
|
|
||||||
|
The `Singleton`-Lifestyle is used to always get the same instance every time an instance is resolved. |
||||||
|
This is specifically useful if you have a service that needs to be accesses by multiple components of your application. |
||||||
|
|
||||||
|
## `Lifestyle.Multiton` |
||||||
|
|||||||
Loading…
Reference in new issue