Whats ResolveAll do

In the IOC, what does ResolveAll do ?? I know that the official answer is "Allow all active components matching this type." Does this mean that it will return any class that implements this interface?

+6
dependency-injection inversion-of-control castle-windsor
source share
4 answers

It will return all classes registered for this interface.

... and do not wait for any links to be resolved. This is a bit of me today!

+10
source share

With Unity, ResolveAll allows each registered mapping for an interface other than the default mapping.

therefore, if you are registered:

 container.RegisterType<IInterface, ActualClassOne>(new ContainerControlledLifetimeManager()); container.RegisterType<IInterface, ActualClassOne>("Singleton", new ContainerControlledLifetimeManager()); container.RegisterType<IInterface, ActualClassOne>("Trans", new TransientLifetimeManager()); 

ResolveAll () will only give you IEnumerable containing the allowed "Singleton" and "Trans" mappings

+2
source share

It will return all classes that have been registered for this interface.

+1
source share

If I have:

container.ResolveAll (new {argument = something}). Where (...)

it seems that all T components get an instance with "something", although not all components fill in the where clause .... who cares about releasing these additional components?

0
source share

All Articles