SimpleInjector.AdvancedApiObject
SimpleInjectorContainerOptions
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
The ContainerOptions type exposes the following members.
Name | Description | |
---|---|---|
AllowOverridingRegistrations |
Gets or sets a value indicating whether the container allows overriding registrations. The default
is false.
| |
ConstructorResolutionBehavior |
Gets or sets the constructor resolution behavior. By default, the container only supports types
that have a single public constructor.
| |
Container |
Gets the container to which this ContainerOptions instance belongs to.
| |
DefaultLifestyle |
Gets or sets the default lifestyle that the container will use when a registration is
made when no lifestyle is supplied. | |
DefaultScopedLifestyle |
Gets or sets the default scoped lifestyle that the container should use when a registration is
made using Lifestyle.Scoped. | |
DependencyInjectionBehavior | Gets or sets the dependency injection behavior. | |
EnableAutoVerification |
Gets or sets a value indicating whether the container should automatically trigger verification
and diagnostics of its configuration when the first service is resolved (e.g. the first call to
GetInstance). The behavior is identical to calling Verify()
manually. The default is true.
| |
EnableDynamicAssemblyCompilation | Obsolete.
This property is obsolete and setting it has no effect. To use dynamic assembly compilation, set
the ExpressionCompilationBehavior property with the custom
IExpressionCompilationBehavior implementation from the
SimpleInjector.DynamicAssemblyCompilation package.
| |
ExpressionCompilationBehavior |
Gets or sets the expression compilation behavior. Changing this behavior allows interception of
the compilation of delegates, for instance debugging purposes. | |
LifestyleSelectionBehavior |
Gets or sets the lifestyle selection behavior. The container's default behavior is to make
registrations using the Transient lifestyle. | |
PropertySelectionBehavior |
Gets or sets the property selection behavior. The container's default behavior is to do no
property injection.
| |
ResolveUnregisteredConcreteTypes |
Gets or sets a value indicating whether the container should resolve unregistered concrete types.
The default value is false. For more information on why resolving unregistered concrete types is disallowed by
default, and what possible fixes you can apply, see https://simpleinjector.org/ructd.
| |
SuppressLifestyleMismatchVerification |
Gets or sets a value indicating whether the container should suppress checking for lifestyle
mismatches (see: https://simpleinjector.org/dialm) when a component is resolved. The default
is false. This setting will have no effect when EnableAutoVerification is true.
| |
UseFullyQualifiedTypeNames |
Gets or sets a value indicating whether all the containers in the current AppDomain should throw
exceptions that contain fully qualified type name. The default is false which means
the type's namespace is omitted.
| |
UseLoosenedLifestyleMismatchBehavior | Obsolete. Gets or sets a value indicating whether the container should use a loosened (i.e. less strict) behavior for detecting lifestyle mismatches (see: https://simpleinjector.org/dialm). 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. The default value is true. 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. | |
UseStrictLifestyleMismatchBehavior | Gets or sets a value indicating whether the container should use a strict behavior for detecting lifestyle mismatches (see: https://simpleinjector.org/dialm). 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. |
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from ApiObject.) | |
GetHashCode | Serves as the default hash function. (Inherited from ApiObject.) | |
GetType | Gets the Type of the current instance. (Inherited from ApiObject.) | |
RegisterResolveInterceptor |
Registers an ResolveInterceptor delegate that allows intercepting calls to
GetInstance and
GetInstance.
| |
ToString | Returns a string that represents the current object. (Overrides ApiObjectToString.) |
Name | Description | |
---|---|---|
ContainerLocking |
Occurs just before the container is about to be locked, giving the developer a last change to
interact and change the unlocked container before it is sealed for further modifications. Locking
typically occurs by a call to Container.GetInstance, Container.Verify, or any other
method that causes the construction and resolution of registered instances.
|
var container = new Container(); container.Register<ITimeProvider, DefaultTimeProvider>(); // Use of ContainerOptions class here. container.Options.AllowOverridingRegistrations = true; // Replaces the previous registration of ITimeProvider container.Register<ITimeProvider, CustomTimeProvider>();