ContainerRegister Method (Type, IEnumerableAssembly, Lifestyle)

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

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

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

Parameters

openGenericServiceType
Type: SystemType
The definition of the open generic type.
assemblies
Type: System.Collections.GenericIEnumerableAssembly
A list of assemblies that will be searched.
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.
InvalidOperationExceptionThrown when the given set of assemblies contain multiple types that implement the same closed generic version of the given openGenericServiceType.
See Also

Reference