I have this small piece of code
var idObjects = Spring.Context.Support.ContextRegistry.GetContext()
.GetObjectsOfType(typeof (ICustomInterfaceThatDoesSomething));
foreach (ICustomInterfaceThatDoesSomething icitds in idObjects.Values)
icitds.DoSomething();
Is there a way i can avoid this by having spring.net automatically inject the singletons to a property i declare, like an array of ICustomInterfaceThatDoesSomething
?
The only reason i want something like this is because i want to kill the .dll dependency on the project and this is the single point of usage.
thanx to Marijin's insight this has been nailed!
Firstly consider this all-purpose utility class
declare it with this configuration sample
and finally inject to the required target
What is trully great with this methodology is that the underlying GetObjectsOfType is not going to be called until you actually execute
GetAllICheImplentations()
(unless you try to execute it during spring init which is not going to bode well)