Registers a single concrete instance that will be constructed using constructor injection and will
be returned when this instance is requested by type TConcrete.
This TConcrete must be thread-safe when working in a multi-threaded
environment.
If TConcrete implements IDisposable, a created instance will
get disposed when Container.Dispose gets called.
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
Type Parameters
- TConcrete
- The concrete type that will be registered.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | Thrown when this container instance is locked and can not be altered, or when TConcrete has already been registered. |
ArgumentException | Thrown when the TConcrete is a type that can not be created by the container. |
See Also