爲何我須要一個IoC容器而不是直接的DI代碼? [關閉]

問題:

I've been using Dependency Injection (DI) for a while, injecting either in a constructor, property, or method. 我一直在使用依賴注入 (DI)一段時間,在構造函數,屬性或方法中注入。 I've never felt a need to use an Inversion of Control (IoC) container. 我從未以爲須要使用控制反轉 (IoC)容器。 However, the more I read, the more pressure I feel from the community to use an IoC container. 可是,我讀的越多,我以爲社區使用IoC容器的壓力就越大。 函數

I played with .NET containers like StructureMap , NInject , Unity , and Funq . 我使用.NET容器,如StructureMapNInjectUnityFunq I still fail to see how an IoC container is going to benefit / improve my code. 我仍然沒有看到IoC容器如何使個人代碼受益/改進。 學習

I'm also afraid to start using a container at work because many of my co-workers will see code which they don't understand. 我也懼怕在工做中開始使用容器,由於個人許多同事都會看到他們不理解的代碼。 Many of them may be reluctant to learn new technology. 他們中的許多人可能不肯意學習新技術。 spa

Please, convince me that I need to use an IoC container. 請說服我須要使用IoC容器。 I'm going to use these arguments when I talk to my fellow developers at work. 當我在工做中與開發人員交談時,我將使用這些論點。 .net


解決方案:

參考一: https://stackoom.com/question/3egv/爲何我須要一個IoC容器而不是直接的DI代碼-關閉
參考二: https://oldbug.net/q/3egv/Why-do-I-need-an-IoC-container-as-opposed-to-straightforward-DI-code-closed
相關文章
相關標籤/搜索