Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding services after container has been built

Is it possible to register a service at run-time, meaning after the ContainerBuilder has been built and the Container has been created (and ContainerBuilder disposed of)?

like image 915
Paul Knopf Avatar asked Feb 15 '11 00:02

Paul Knopf


1 Answers

Yes you can, using the Update method on ContainerBuilder:

var newBuilder = new ContainerBuilder(); newBuilder.Register...;  newBuilder.Update(existingContainer); 
like image 90
Peter Lillevold Avatar answered Oct 14 '22 18:10

Peter Lillevold