You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing an obsolete warning when trying to use this lifestyle:
warning CS0618: 'LifetimeScopeLifestyle' is obsolete: 'This lifestyle is obsolete. Please use SimpleInjector.Lifestyles.ThreadScopedLifestyle instead.'
This lifestyle is deliberately left out of Simple Injector because it is considered to be harmful. Instead of using Per Thread lifestyle, you will usually be better of using one of the Scoped lifestyles.
I'm thinking the documentation needs to be updated?
Could use some guidance on when to use various lifestyles.
The text was updated successfully, but these errors were encountered:
You are getting is warning because you are using an alpha version of Simple Injector v4. We don't have any documentation for v4 yet.
I do agree however that we should make the difference between the ThreadScopedLifestyle and a non-existing per-thread lifestyle clear in the v4 documentation.
But the guidance is as follows: Simple Injector supports several scoped lifestyles and both Transient and Singleton. They are all safe for use. The built-in ThreadScopedLifestyle is completely different from the described per-thread lifestyle and doesn't have the same pitfalls and dangers as a per-thread lifestyle has. The ThreadScopedLifestyle (or LifetimeScopeLifestyle in v3) is safe to use.
dotnetjunkie
changed the title
Obsolete LifetimeScopeLifestyle is confusing
Obsolete LifetimeScopeLifestyle is confusing
Feb 8, 2017
I'm seeing an obsolete warning when trying to use this lifestyle:
Using LifetimeScope based on this answer: https://stackoverflow.com/questions/39248736/with-lifestyle-to-use-for-console-application.
This is especially confusing when combined with this on the SimpleInjector documentation under the PerThread lifestyle:
I'm thinking the documentation needs to be updated?
Could use some guidance on when to use various lifestyles.
The text was updated successfully, but these errors were encountered: