Dependency injection: How to pass the injection container around?

前端 未结 2 991
醉酒成梦
醉酒成梦 2020-12-31 21:35

(This question does not rely on a specific IoC framework, so the interfaces and types in my samples are meta-types. Just replace them with the appropriate types for your fav

2条回答
  •  借酒劲吻你
    2020-12-31 22:08

    It's best to avoid injecting the injector. Just create the types you need, and then start executing. I've written a somewhat longer post on this topic: Accessing the DI container

提交回复
热议问题