Registers that a new instance of TImplementation will be returned every time a
TService is requested (transient).
Namespace: SimpleInjector
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax
public void Register<TService, TImplementation>() where TService : class where TImplementation : class, TService
Type Parameters
- TService
- The interface or base type that can be used to retrieve the instances.
- TImplementation
- 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 TService has already been registered. |
ArgumentException | Thrown when the given TImplementation type is not a type that can be created by the container. |
Remarks
See Also