Introducing an IoC Container to Legacy Code

后端 未结 2 1676
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 05:10

I\'m writing a new .NET library for internal use at my company that will use IoC through Dependency Injection. Naturally, this library will be much easier to use if we use

2条回答
  •  不思量自难忘°
    2020-12-10 06:03

    As I understand your question, you want to invoke DI-enabled code from legacy code.

    The best option is to keep the new library DI Friendly, but container-agnostic.

    Doing this, you can provide a simple Facade the legacy code can use. No need for the legacy app to use any DI Container, and no need for the Common Service Locator.

提交回复
热议问题