Skip to content
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

Provide a way to instantiate Tegral DI components without full Tegral DI environments #33

Open
utybo opened this issue Aug 10, 2022 · 0 comments

Comments

@utybo
Copy link
Owner

utybo commented Aug 10, 2022

A limitation of Tegral DI compared to solutions that use a constructor-based approach to dependency injection is that it is not possible to instantiate Tegral DI components by just giving them the correct parameters. Tegral DI components are "polluted" with a scope: InjectionScope parameter.

  • Since Tegral DI components may be interlinked and intertwined in non-trivial ways, it is almost always better to just spin up a regular Tegral DI environment and add components this way.
  • If creating a DI environment is not possible, a workaround would be to implement a fake InjectionScope that would return from a list of hardcoded instances. This is only really useful in the case of having a single components that depends on several "non-polluted" classes that are trivial to instantiate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant