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 ProductLocator, PricingService, etc. are called out in the constructor parameters as Interfaces, not concrete classes. How does the IoC container know which implementations of IProductLocator, IPricingService, etc. to instantiate?
Is the IoC Container smart enough to use the same ConfigProvider for both dependencies (if that is the requirement)?
stringorint) have to be provided by configuration. The specific question of theConfigProvideris usually handled by configuring a named instance; that way multiple objects can share a single instance of a dependency.