I had a similar question a while back, but with much less of a grasp of the whole IoC/DI topic and as well as what I was aiming to achieve, so here goes again....
I am building a library for common use within our company. The most commonly used parts of the public API are already IoC friendly, but in the lower level areas, there's still quite some newing up going on, which I'd like to get rid of (though at this time more for formal reasons than real necessity).
This in itself will be easy enough to do, but then of course everytime the library is being used, all the components have to be wired up again. As this will pretty much always look the same, I'd normally just wrap those default registrations in an Autofac module and be done with it.
(Here's question 1: Would this module go in the main library assembly or should it be a standalone package, even if Autofac would likely be the only IoC container being used with the library?)
Now the problem is that I am currently the only developer in the company that really sees the purpose of IoC or knows what an IoC container does at all, let alone how it is used, and it would be a bad idea to tell everyone else they can either use the Autofac package or just build a graph of a dozen+ objects manually using poor man's DI. (I know the guys - they would just leave it alone and build what they need themselves, because I'm crazy anyway with all my many tiny classes.)
What I thought about to solve this is adding something like a Service Locator from which to pull preconfigured objects for the commonly needed types (which would look the same as those wired up by the Autofac module), maybe wired up internally by a lightweight IoC container.
I know that Service Locator is an antipattern and which kinds of problems it creates, and I'd never use it as the (my) means of object composition, but as a "shortcut" for the IoC/SOLID impaired, would it be feasible? What other options would I have? Might it even make sense in that case to include the Autofac module with the library and just have the "Service Locator" act as a frontend to it?