private void Dispose(bool disposing) { if (disposing) GC.SuppressFinalize(this); ScopeContainer.EndScope(); ScopeContainer = null; }
public virtual IScopeProvider EndScope(IExtendedScopeProvider scope) { ValidateEndScopeWhitException(scope); ChildScope.Dispose(); InvalidateBinding(typeof(IExtendedScopeProvider)); return this; }
protected bool ValidateScope(IExtendedScopeProvider scope, out IScopeProvider parentScope) { parentScope = null; if (ChildScope.IsNull()) return false; if (scope.IsNull()) return false; return ChildScope.ScopeId == scope.ScopeId; }
public virtual bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope) { if (!ValidateScope(scope, out parentScope)) return false; ChildScope.Dispose(); parentScope = this; InvalidateBinding(typeof(IExtendedScopeProvider)); return true; }
protected void ValidateEndScopeWhitException(IExtendedScopeProvider scope) { if (ChildScope.IsNull()) throw new InvalidDataException("Unable to terminate scope, the current scope does not have a child scope"); if (scope.IsNull()) throw new NullReferenceException("Provided scope is null"); if (ChildScope.ScopeId != scope.ScopeId) throw new InvalidDataException("Unable to terminate scope, actual scope not the same as provided scope"); }
public virtual bool TryBeginExtendedScope(out IExtendedScopeProvider childScope) { bool result; if (ChildScope.IsInstance()) { result = false; childScope = null; } else { ChildScope = (IExtendedScopeProvider)Activator.CreateInstance(Container.ExtendedContextProvider, this); result = true; childScope = ChildScope; } return result; }
public override bool TryBeginExtendedScope(out IExtendedScopeProvider childScope) { childScope = this; return true; }
public override bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope) { parentScope = this; return(true); }
internal StardustDependencyScope() { ScopeContainer = ContainerFactory.Current.GetProvider(Scope.Context).BeginExtendedScope(); }
public override bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope) { if (!ValidateScope(scope, out parentScope)) return false; ChildScope.Dispose(); parentScope = this; ChildScope = null; return true; }
public override IScopeProvider EndScope(IExtendedScopeProvider scope) { ValidateEndScopeWhitException(scope); ChildScope.Dispose(); ChildScope = null; return this; }
public override IScopeProvider EndScope(IExtendedScopeProvider scope) { return(this); }
public override bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope) { parentScope = this; return true; }
public AutoFacExtendedScope(IContainer container, IExtendedScopeProvider scope) { Container = container; Scope = scope; AfScope = container.BeginLifetimeScope(); }
public AutoFacExtendedScope(IContainer container, IExtendedScopeProvider scope) { Container = container; Scope = scope; AfScope = container.BeginLifetimeScope(); }
public IExtendedScopeProvider BeginExtendedScope(IExtendedScopeProvider scope) { return(new AutoFacExtendedScope(Container, scope)); }
public IExtendedScopeProvider BeginExtendedScope(IExtendedScopeProvider scope) { return(scope); }
internal StardustDependencyScope() { ScopeContainer = ContainerFactory.Current.GetProvider(Scope.Context).BeginExtendedScope(); }
public override IScopeProvider EndScope(IExtendedScopeProvider scope) { return this; }
public override bool TryBeginExtendedScope(out IExtendedScopeProvider childScope) { childScope = this; return(true); }