ContainerRegisterSingleton Method (Type, Assembly)

Simple Injector
Registers all concrete, non-generic, public and internal types in the given set of assemblies that implement the given openGenericServiceType with Singleton lifestyle. Decorators and generic type definitions will be excluded from registration, while composites are included.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 5.3.0
Syntax

public void RegisterSingleton(
	Type openGenericServiceType,
	params Assembly[] assemblies
)

Parameters

openGenericServiceType
Type: SystemType
The definition of the open generic type.
assemblies
Type: System.ReflectionAssembly
A list of assemblies that will be searched.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when one of the arguments contain a null reference.
ArgumentExceptionThrown when openGenericServiceType is not an open generic type.
InvalidOperationExceptionThrown when the given set of assemblies contain multiple types that implement the same closed generic version of the given openGenericServiceType.
See Also

Reference