Can someone explain Microsoft Unity?

前端 未结 7 1650
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 06:55

I\'ve been reading the articles on MSDN about Unity (Dependency Injection, Inversion of Control), but I think I need it explained in simple terms (or simple examples). I\'m

7条回答
  •  自闭症患者
    2020-12-07 07:19

    Unity is an IoC. The point of IoC is to abstract the wiring of dependencies between types outside of the types themselves. This has a couple of advantages. First of all, it is done centrally which means you don't have to change a lot of code when dependencies change (which may be the case for unit tests).

    Furthermore, if the wiring is done using configuration data instead of code, you can actually rewire the dependencies after deployment and thus change the behavior of the application without changing the code.

提交回复
热议问题