Skip to content

Commit

Permalink
Change BeginScope to utilize the self contained current scope
Browse files Browse the repository at this point in the history
  • Loading branch information
generik0 committed Dec 7, 2020
1 parent 9d8a864 commit d3aecbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ protected ExtensionContainerScope(
public ExtensionContainerRootScope RootScope
=> this as ExtensionContainerRootScope ?? rootScope;

public static ExtensionContainerScope BeginScope(ExtensionContainerScope parent, ExtensionContainerRootScope rootScope)
public static ExtensionContainerScope BeginScope()
{
var parent = Current;
var rootScope = Current?.RootScope;
if (rootScope == null)
throw new ArgumentNullException(nameof(rootScope));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ public WindsorScopeFactory(
public IServiceScope CreateScope()
{
var scope =
ExtensionContainerScope
.BeginScope(
ExtensionContainerScope.Current,
rootScope);
ExtensionContainerScope.BeginScope();

//since WindsorServiceProvider is scoped, this gives us new instance
var provider = scopeFactoryContainer.Resolve<IServiceProvider>();
Expand Down

0 comments on commit d3aecbf

Please sign in to comment.