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.
Assembly: SimpleInjector (in SimpleInjector.dll) Version: 4.6.0
public void RegisterSingleton<TConcrete>() where TConcrete : class
Public Sub RegisterSingleton(Of TConcrete As Class)
- The concrete type that will be registered.
|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.|