UnregisteredTypeEventArgsRegister Method (Expression)

Simple Injector
Registers an Expression that describes the creation of instances of the type expressed by the UnregisteredServiceType for this and future requests. The delegate will be cached and future requests will directly use that expression or the compiled delegate.

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

public void Register(
	Expression expression
)

Parameters

expression
Type: System.Linq.ExpressionsExpression
The expression that describes the creation of instances of the type expressed by the UnregisteredServiceType.
Exceptions

ExceptionCondition
ArgumentNullExceptionThrown when the expression is a null reference.
ActivationExceptionThrown when multiple observers that have registered to the ResolveUnregisteredType event called this method for the same type.
Remarks

NOTE: If possible, use the Register(Registration) overload, since this allows the analysis services to determine any configuration errors on the lifestyle of the registration.
See Also

Reference