I think that the way to pass this can be, if you want to be able to unit test your code, you need to distract everything depending on what you are testing. You can do this with a vendor model, but that means there is so much more to go through vendors than you probably want to deal with.
Suppose you have an application that calls some external third-party services, but also has a local database. Sometimes your controllers call the "provider" (for external services), but sometimes they call the "repository" for the local database. So, how are you going to use unit test methods that invoke the repository? I think you need to divert your entire local database through providers. In this case, you will either end up with one or two huge provider implementations (poor design to have too many methods for each class), or you will have many small providers (configuration nightmare).
With an IOC container, you can do most of the wiring in the code itself. Using a fake frame simplifies unit testing. Therefore, if you really want this, you can use the Providers for "external calls" and the IOC for "internal calls".
I just think about it because we have a lot of legacy code in the providers, and I think about moving away from them and just use the direct IOC. I believe that IOC containers such as AutoFac can replicate this requirement in order to โplug inโ another implementation through configuration, so you donโt lose anything.
More about my blog post - I hope the blog will also get good comments about it: http://healthedev.blogspot.com/2011/12/making-custom-built-applications.html
nootn source share