How better to resolve dependencies in object created by factory?

For dependencies that are independent of the instance you’re creating, inject them into the factory and store them until needed.

For dependencies that are independent of the context of creation but need to be recreated for each created instance, inject factories into the factory and store them.

For dependencies that are dependent on the context of creation, pass them into the Create method of the factory.

Leave a Comment