Hi guys Just a quick one.
In IOC's what does ResolveAll do?? I know that the offical answer is "Resolve all valid components that match this type." but does that mean that it will return any class that implements a given interface?
Cheers Anthony
Hi guys Just a quick one.
In IOC's what does ResolveAll do?? I know that the offical answer is "Resolve all valid components that match this type." but does that mean that it will return any class that implements a given interface?
Cheers Anthony
It will return all classes that were registered for a given interface.
It will return all classes that were registered for a given interface.
...and are not waiting on any references to be resolved. This bit me today!
With Unity, ResolveAll resolves each registered mapping for an interface except for the default mapping.
so if you 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 an IEnumerable containing a resolved "Singleton" and "Trans" mappings