ContainerGetRegistration Method (Type, Boolean)

Simple Injector
Gets the InstanceProducer for the given serviceType. When no registration exists, the container will try creating a new producer. A producer can be created when the type is a concrete reference type, there is an ResolveUnregisteredType event registered that acts on that type, or when the service type is an IEnumerableT. Otherwise null is returned, or an exception is throw when throwOnFailure is set to true.

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

public InstanceProducer GetRegistration(
	Type serviceType,
	bool throwOnFailure
)

Parameters

serviceType
Type: SystemType
The Type that the returned instance producer should produce.
throwOnFailure
Type: SystemBoolean
The indication whether the method should return null or throw an exception when the type is not registered.

Return Value

Type: InstanceProducer
An InstanceProducer or null.
Remarks

A call to this method might lock the container.

Note: This method is not guaranteed to always return the same InstanceProducer instance for a given Type. It will however either always return null or always return a producer that is able to return the expected instance.

See Also

Reference