Skip to content

Injection of a dynamic class #586

@GuySuday

Description

@GuySuday

Given a class known at runtime (dynamic) with dependencies in the c'tor, can we use the container to initialize such class?

I saw the guide of dynamic containers, but it requires to know the dynamic class' dependencies before runtime.

Following the example from the guide:
Let's assume both UserService and AuthService have dependencies in their c'tors, and of of the dependencies are from a (static) known set of values.
How would we instantiate the classes given we don't know the classes beforehand (and especially not their dependencies), because they are known only at runtime (from a condif file e.g)?

Thank you for your help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions