Registers that an instance of TConcrete will be returned when it
is requested. The instance is cached according to the supplied lifestyle.
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
Parameters
- lifestyle
- Type: SimpleInjectorLifestyle
The lifestyle that specifies how the returned instance will be cached.
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 an the TConcrete has already been registered. |
ArgumentException | Thrown when the TConcrete is a type that can not be created by the container. |
See Also