ContainerGetRootRegistrations Method

Simple Injector
Returns an array with the current registrations for root objects. Root objects are registrations that are in the root of the object graph, meaning that no other registration is depending on it.

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

public InstanceProducer[] GetRootRegistrations()

Return Value

Type: InstanceProducer
An array of InstanceProducer instances.

InvalidOperationExceptionThrown when this method is called before Verify has been successfully called.

This method has a performance characteristic of O(n). Prevent from calling this in a performance critical path of the application.

This list contains the root objects of all explicitly registered types, and all implicitly registered instances. Implicit registrations are all concrete unregistered types that have been requested, all types that have been resolved using unregistered type resolution (using the ResolveUnregisteredType event), and requested unregistered collections. Note that the result of this method may change over time, because of these implicit registrations.

Note: This method is not guaranteed to always return the same InstanceProducer instance for a given registration. It will however either always return a producer that is able to return the expected instance. Because of this, do not compare sets of instances returned by different calls to GetCurrentRegistrations by reference. The way of comparing lists is by the actual type. The type of each instance is guaranteed to be unique in the returned list.

See Also