When you use an IoC container, like so:
var svc = IoC.Resolve<IShippingService>();
How does the IoC Container choose which implementation of
IShippingService to instantiate?
Further, if I am calling the above to replace the equivalent code:
var svc = new ShippingService(new ProductLocator(), new PricingService(), new InventoryService(), new TrackingRepository(new ConfigProvider()), new Logger(new EmailLogger(new ConfigProvider())));
I assume that
PricingService, etc. are called out in the constructor parameters as Interfaces, not concrete classes. How does the IoC container know which implementations of
IPricingService, etc. to instantiate?
Is the IoC Container smart enough to use the same
ConfigProvider for both dependencies (if that is the requirement)?