-
Notifications
You must be signed in to change notification settings - Fork 716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency tree #535
Comments
I just built the tree dependency tree by reading the metadata of each class, keys inversify:tagged and inversify:tagged_props |
Hi @gagle sorry for the late reply I was on holidays... checkout the metadata middleware feature I have a feeling that maybe could be useful for your use case. |
Hi @remojansen , this definitely will work to get the metadata in a consistent way. Thanks! |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can I get the dependency tree of a chain of injectables A injects B injects C?
I'm trying to implement some kind of framework on top of inversify. I would like to do the following list of things:
Point 1 is resolved, so this is not a problem but with point 2 I'm having some difficulties and I don't know if I could solve it without a change in inversify. We already know the problem with issue #418.
Acomponent is a singleton class wich implements some lifecycle functions such as
init()
anddestroy()
. Concrete components of this framework will inherit from the base Component class.By automatic binding I mean that I don't want the user to use inversify directly. For now what I'm doing is a thin wrapper arround
inject()
andinjectable()
. Each timeinjectable()
is called I store in the metadata of a ComponentContainer class the class Component that is going to be injected later:Then later there's some point when I read all the injectables, create the container and bind all of them in the following way:
I always know the main component so I can resolve the dependencies by using
resolve()
orget()
.To try to solve the async init I could call to the init() function manually in the same order that injectables dependencies are resolved by inversify. If A injects B and B injects C, classes are instantiated in a predictable way: C, B, A.
So I think that here I have a chance to call init() in the same order that te components are instantiated.
The text was updated successfully, but these errors were encountered: