What is the proper way to resolve multiple instances of the same object?

25 views
Skip to first unread message

Leonard Kruc

unread,
Jun 28, 2019, 6:11:04 AM6/28/19
to StrangeIoC
I've been working with Strange for several month now, but there is a one thing hings I can't figure out in StrangeIoC and DI in general is how to properly resolve multiple instances of objects.

Just as an example:
Say, I have a manager that handles a number of objects, and each object is an object-graph that I would like to be injectable.
I need to multiple copies of those objects. 
My current approach is to simply inject a InjectionBinder and use GetInstance<>() to resolve many instances inside a for loop.

Now, that works fine. But as I understand it can turn DI container into Service Locator, and create a situation where class knows about the DI container.
It doesn't really seem to be a major problem, but creating multiple instances of objects is a such fundamental action that I want to make sure I'm using the best approach.

Is there a better way to approach this? 
Thank you!


Reply all
Reply to author
Forward
0 new messages