ContainerOptionsUseStrictLifestyleMismatchBehavior Property

Simple Injector

Gets or sets a value indicating whether the container should use a strict behavior for detecting lifestyle mismatches (see: In short, when UseStrictLifestyleMismatchBehavior is set to falseTransient dependencies are allowed to be injected into Scoped components. When enabled, a warning would be given in that case. The default value is false.

Simple Injector allows custom lifestyles to be created and this strict behavior works on custom lifestyles as well. When set to false. Simple Injector ignores 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: 5.0.0

public bool UseStrictLifestyleMismatchBehavior { get; set; }

Property Value

Type: Boolean
The value indicating whether the container uses strict behavior when validating mismatches on Scoped components.
See Also