public IDisposable BeginScope() { var scope = new LifestyleScope(); GetCurrentScopes().Push(scope); return(new EndScope(this, scope)); }
private void EndCurrentScope(LifestyleScope scope) { var scopes = GetCurrentScopes(); if (scopes.Peek() != scope) { throw new InvalidOperationException( "The scope is not current. Did you forget to end a child scope?"); } scope.Dispose(); scopes.Pop(); }
public EndScope(ScopeSubsystem manager, LifestyleScope scope) { _manager = manager; _scope = scope; }
public IDisposable BeginScope() { var scope = new LifestyleScope(); GetCurrentScopes().Push(scope); return new EndScope(this, scope); }