private void Dispose(bool disposing)
 {
     if (disposing)
         GC.SuppressFinalize(this);
     ScopeContainer.EndScope();
     ScopeContainer = null;
 }
Exemplo n.º 2
0
 public virtual IScopeProvider EndScope(IExtendedScopeProvider scope)
 {
     ValidateEndScopeWhitException(scope);
     ChildScope.Dispose();
     InvalidateBinding(typeof(IExtendedScopeProvider));
     return this;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 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");
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 public override bool TryBeginExtendedScope(out IExtendedScopeProvider childScope)
 {
     childScope = this;
     return true;
 }
Exemplo n.º 8
0
 public override bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope)
 {
     parentScope = this;
     return(true);
 }
Exemplo n.º 9
0
 internal StardustDependencyScope()
 {
     ScopeContainer = ContainerFactory.Current.GetProvider(Scope.Context).BeginExtendedScope();
 }
Exemplo n.º 10
0
 public override bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope)
 {
     if (!ValidateScope(scope, out parentScope)) return false;
     ChildScope.Dispose();
     parentScope = this;
     ChildScope = null;
     return true;
 }
Exemplo n.º 11
0
 public override IScopeProvider EndScope(IExtendedScopeProvider scope)
 {
     ValidateEndScopeWhitException(scope);
     ChildScope.Dispose();
     ChildScope = null;
     return this;
 }
Exemplo n.º 12
0
 public override IScopeProvider EndScope(IExtendedScopeProvider scope)
 {
     return(this);
 }
Exemplo n.º 13
0
 public override bool TryEndScope(IExtendedScopeProvider scope, out IScopeProvider parentScope)
 {
     parentScope = this;
     return true;
 }
Exemplo n.º 14
0
 public AutoFacExtendedScope(IContainer container, IExtendedScopeProvider scope)
 {
     Container = container;
     Scope     = scope;
     AfScope   = container.BeginLifetimeScope();
 }
Exemplo n.º 15
0
 public AutoFacExtendedScope(IContainer container, IExtendedScopeProvider scope)
 {
     Container = container;
     Scope = scope;
     AfScope = container.BeginLifetimeScope();
 }
Exemplo n.º 16
0
 public IExtendedScopeProvider BeginExtendedScope(IExtendedScopeProvider scope)
 {
     return(new AutoFacExtendedScope(Container, scope));
 }
Exemplo n.º 17
0
 public IExtendedScopeProvider BeginExtendedScope(IExtendedScopeProvider scope)
 {
     return(scope);
 }
 internal StardustDependencyScope()
 {
     ScopeContainer = ContainerFactory.Current.GetProvider(Scope.Context).BeginExtendedScope();
 }
Exemplo n.º 19
0
 public override IScopeProvider EndScope(IExtendedScopeProvider scope)
 {
     return this;
 }
Exemplo n.º 20
0
 public override bool TryBeginExtendedScope(out IExtendedScopeProvider childScope)
 {
     childScope = this;
     return(true);
 }