Use DIOD library for enabling dependency injection #1382
Unanswered
NickSeagull
asked this question in
Refactors and standards
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If we switch to a class based service approach we can easily benefit from automatic dependency injection, instead of having to pass services around manually.
I don't like the usage of dependency injection frameworks as they do a lot of magic under the hoods in runtime.
Yet, there's the
diod
library, that is a very thin layer that helps constructing the instances of the services based on the metadata generated by the TypeScript compiler (ormetadata-booster
, which is compatible).The tl;dr is something like:
The good part about this is that we can make the decorator add stuff like automatic tracing to all of our services for free (#1383)
Related discussions
Beta Was this translation helpful? Give feedback.
All reactions