ContainerGetRegistrationTService Method

Simple Injector
Gets the InstanceProducer for the given TService. 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.

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

public InstanceProducer GetRegistration<TService>()
where TService : class

Type Parameters


[Missing <typeparam name="TService"/> documentation for "M:SimpleInjector.Container.GetRegistration``1"]

Return Value

Type: InstanceProducer
An InstanceProducer or null.

A call to this method locks the container. New registrations can't be made after a call to this method.

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