I have a library handling interactions with a database backend that I use in most of my applications and now want to convert to an IoC structure (using Autofac internally, but its usage should not depend on a specific IoC container or even on using one at all). How would I go about wiring up the library's internal dependencies in a "default" way without the application having to take care of it, but with the ability to provide other implementations if necessary ?
As an example: The library can store and read connection credentials for different backend servers on/from the user's hard drive. Part of this information, at least the passwords, is encrypted, usually with the default encryption defined in the library - so normally I won't want to care about the details in my application that uses the library. But there might be cases where I need to provide a different encryption algorithm (e.g. through an IConnectionEncryption
interface) when calling the logon method from my application.
What do I need to do in my library and in my application to achieve this ?