The lifestyle that caches components according to the lifetime of the container's configured scoped lifestyle.
In case the type of a cached instance implements IDisposable, the container will ensure its disposal when the active scope gets disposed.
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
Field Value
Type: ScopedLifestyleExamples
C#
// Create a Container instance, configured with a scoped lifestyle. var container = new Container(new WebRequestLifestyle()); container.Register<ITimeProvider, RealTimeProvider>(Lifestyle.Scoped);
See Also