ContainerRegister Method (Type, IEnumerableType, Lifestyle)

Simple Injector
Registers all supplied implementationTypes based on the closed-generic version of the given openGenericServiceType with the given lifestyle.

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

public void Register(
	Type openGenericServiceType,
	IEnumerable<Type> implementationTypes,
	Lifestyle lifestyle
)

Parameters

openGenericServiceType
Type: SystemType
The definition of the open generic type.
implementationTypes
Type: System.Collections.GenericIEnumerableType
A list types to be registered.
lifestyle
Type: SimpleInjectorLifestyle
The lifestyle to register instances with.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when one of the arguments contain a null reference (Nothing in VB).
ArgumentExceptionThrown when openGenericServiceType is not an open generic type or when one of the supplied types from the implementationTypes collection does not derive from openGenericServiceType.
InvalidOperationExceptionThrown when the given set of implementationTypes contain multiple types that implement the same closed generic version of the given openGenericServiceType.
See Also

Reference