Skip to content

Commit

Permalink
Update CoreContainer to start a new lifetime scope from the existing …
Browse files Browse the repository at this point in the history
…scope rather than from the container.
  • Loading branch information
tippmar-nr committed Jul 14, 2023
1 parent 04b84e3 commit 9eaac69
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ public void Build()

public void ReplaceRegistrations()
{
scope.Dispose(); // dump the existing scope
// create a new nested scope, registering the requested replacement instances
scope = scope.BeginLifetimeScope(ReplaceRegistrations);

scope = this.container.BeginLifetimeScope(ReplaceRegistrations); // create a new scope, registering all replacement instances
_registrationsToReplace.Clear();
}

private void ReplaceRegistrations(ContainerBuilder builder)
Expand Down

0 comments on commit 9eaac69

Please sign in to comment.