So lets say i have this code
var builder = new ContainerBuilder();
builder.RegisterInstance(new MyType());
var container = builder.Build();
Then some time later I want to change the instance of MyType
for all future resolves that are called on container
.
At the time you want to change the registration, create a new ContainerBuilder
, register the new instance, and call Update
passing in the container:
// at some later point...
builder = new ContainerBuilder();
builder.RegisterInstance(myType2);
builder.Update(container);