Occasionally I find myself in a situation where I need to resolve a service only if a certain condition is met. For example, a user might select to send an email or an sms notification. I would like to lazy load the email or sms service depending on what the user chooses so that I don't have to load both of them and waste resources (what if there were, for example, 10 options for the user...?).
The problem I have is with using the container outside of my bootstrap code (I dont want my code dependent on th container). I can't seem to find a way around using the container for lazy loading services (unless I create the needed services by hand and do all the DI manually). Is this a situation where the rules can be bent or is there a better way of doing it?