Typically you would expect that the last registration for a given service would result in that implementation type being the type that will be resolved. This occurs given the following test:
However if you first locate the type and then modify the registrations the initial registration is cached and the new registration does not take effect.
container.Configure(c => c.Export(typeof(IServiceA)).As(typeof(ServiceA1)));
var instance = container.Locate(typeof(IServiceA));
Assert.IsType<ServiceA1>(instance);
// Update the container
container.Configure(c => c.Export(typeof(IServiceA)).As(typeof(ServiceA2)));
instance = container.Locate(typeof(IServiceA));
Assert.IsType<ServiceA2>(instance); // Fails because it resolved ServiceA1
Description
Typically you would expect that the last registration for a given service would result in that implementation type being the type that will be resolved. This occurs given the following test:
However if you first locate the type and then modify the registrations the initial registration is cached and the new registration does not take effect.