public SupportContextServiceScope(SupportContextServiceProvider parent, IServiceScope scope)
 {
     if (parent == null)
     {
         throw new ArgumentNullException(nameof(parent));
     }
     _scope          = scope ?? throw new ArgumentNullException(nameof(scope));
     ServiceProvider = new SupportContextServiceProvider(scope.ServiceProvider, parent);
 }
 public SupportContextServiceProvider(IServiceProvider provider, SupportContextServiceProvider parent) : this()
 {
     _provider = provider ?? throw new ArgumentNullException(nameof(provider));
     Parent    = parent;
     Root      = parent?.Root ?? this;
     Id        = CreateId();
     if (!ServiceContext.Push(this))
     {
         throw new InvalidOperationException();
     }
 }
 public bool IsMyParent(SupportContextServiceProvider provider)
 {
     for (var parent = Parent;
          parent != null;
          parent = parent.Parent)
     {
         if (ReferenceEquals(parent, provider))
         {
             return(true);
         }
     }
     return(false);
 }
 public SupportContextServiceScopeFactory(SupportContextServiceProvider provider, IServiceScopeFactory factory)
 {
     _provider = provider ?? throw new ArgumentNullException(nameof(provider));
     _factory  = factory ?? throw new ArgumentNullException(nameof(factory));
 }
Example #5
0
 public ServiceProviderAccessor(SupportContextServiceProvider provider)
 {
     _provider = provider;
     _id       = provider?.Id ?? -1;
 }