ContainerOptionsUseLoosenedLifestyleMismatchBehavior Property

Simple Injector

Gets or sets a value indicating whether the container should use a loosened (i.e. less strict) behavior for detecting lifestyle mismatches (see: In short, when UseLoosenedLifestyleMismatchBehavior is set to trueTransient dependencies are allowed to be injected into Scoped components. When disabled, a warning would be given in that case.

Simple Injector allows custom lifestyles to be created and this loosened behavior works on custom lifestyles as well. The loosened behavior will ignore any lifestyle mismatch checks on any component with a lifestyle that has a Length that is equal or shorter than the length of Scoped.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 4.9.1

public bool UseLoosenedLifestyleMismatchBehavior { get; set; }

Property Value

Type: Boolean
See Also