Skip to content

Can I achieve the functionality of nested/child container with StrongInject? #173

Answered by YairHalberstadt
ekalchev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @ekalchev there are various mechanisms that can be used to achieve something similar, but first I have to understand what you're trying to achieve.

If the purpose is purely to reduce the scope of some dependencies, then the InstancePerResolution scope might be appropriate. This creates a new instance every time you resolve the instance at a different time (e.g. by use of a Func), but shares any instances that are all resolved at once (e.g. if both b and c depend on a, and d depends on b and c, then if you resolve d, both b and c will share instances of a.

If that's not exactly what you need, please let me know more exactly what semantics you need, and I can try and guide you in the rig…

Replies: 1 comment 15 replies

Comment options

You must be logged in to vote
15 replies
@ekalchev
Comment options

@YairHalberstadt
Comment options

@YairHalberstadt
Comment options

@ekalchev
Comment options

@YairHalberstadt
Comment options

Answer selected by ekalchev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants