Can anyone explain to me, at length, how to use IOC containers?

后端 未结 7 1728
执笔经年
执笔经年 2021-02-05 15:47

I use dependency injection through parameters and constructors extensively. I understand the principle to this degree and am happy with it. On my large projects, I end up with t

7条回答
  •  醉话见心
    2021-02-05 16:42

    IoC containers usually do the dependency injections which in some projects are not a big deal , but some of the frameworks that provide IoC containers offer other services that make it worth to use them. Castle for example has a complete list of services besides an IoC container.Dynamic proxies ,Transaction management and NHibernate facilities are some of them. Then I think you should consider IoC contianers as a part of an application framework.

    Here's why I use an IoC container: 1.Writing unit tests will be easier .Actually you write different configurations to do different things 2.Adding different plugins for different scenarios(for different customers for example) 3.Intercepting classes to add different aspects to our code. 4.Since we are using NHibernate ,Transaction management and NHibernate facilites of Castle are very helpful in developing and maintaining our code . It's like every technical aspects of our application is handled using an application framework and we have time to think about what customers really want.

提交回复
热议问题