Closed driis closed 12 years ago
Dennis,
That is a clever way of supporting injections dependencies through an initializer that bootstraps an existing feature. Generally, I like the pull request and I'm inclined to merge it.
I'm going to go through a couple code segments and suggest some small stylistic changes before I merge it however.
Stay tuned.
Dennis,
Thanks for the updates. I'll pull your changes in via a branch at some point this week. After some thought I'd like to perform a refactor of how dependencies, in general, are injected. It seems to me we have a number of different strategies or approaches to injection now. I'd like to abstract those strategies into their own classes instead of tacking them on in the JSObjectionInjectorEntry,
Justin,
Thanks. If you need anything more from me, just ask. It will be great to have this feature included in Objection.
/Dennis
is anything more happening with this?
I would still love to have this feature included in objection, so I am hoping Justin will accept the pull request soon.
Just for the record, I would be happy to make any minor changes or refactorings needed, add any tests that you feel are missing, etc, etc.
Sorry guys,
I'll merge this change. But I'd like to merge it into a different branch other than master. There are a few stylistic changes I'd like to make before merging it into master.
driis. Can you close this pull request and re-open it against development.
Thanks.
Thanks, I've opened a pull request against development. ( #24 )
This pull requests adds support for initializers to be truly dependent on types registered with Objection. Currently, when using objection_initializer, one has to know the concrete dependency either when the type is registered, or when it is resolved. It would be nice to simply register the initializer one would like to use, and let it be up to Objection to resolve it's depencies when calling getObject; this is what this pull request adds.
You can now use objection_initializer like this:
The first dependency will then be resolved when calling getObject, instead of being specified when the type is registered. Of course this also works the other way around for getObjectWithArgs, using JSObjectionDependency here allows you to override a dependency with whatever is currently registered with Objection.
There are tests for this in InitializerSpecs.m. Most of the new feature is in JSObjectionUtils.m.
I think this would be a nice addition to the Objection framework, and hope you will accept it. If you should agree with the feature, but disagree with the style or way it is implemented, please tell me and I will try to improve ;-)