public DependencyInjectionContainer(ContainerServices services = null)
        {
            Services = services ?? ContainerServices.DefaultServices;
            Scope    = Services.ContainerScopeFactory.CreateScope();
            _registrationMappings = Services.ConcurrentDictionaryFactory.Create <Type, IConcurrentList <Registration> >();
            _resolveDelegates     = Services.ConcurrentDictionaryFactory.Create <ResolveDelegateId, ResolveDelegate>();

            Scope.TryAddDisposable(_registrationMappings);
            Scope.TryAddDisposable(_resolveDelegates);
            Services.SetupContainer?.Invoke(this);
        }
示例#2
0
            public void Prepare()
            {
                var targets = new TargetContainer();

                this.child = new OverridingContainer(this.parent);
                child.RegisterType <ScopedTransient, ITransient1>();
                child.RegisterType <ScopedCombined1, ICombined1>();
                child.RegisterType <ScopedCombined2, ICombined2>();
                child.RegisterType <ScopedCombined3, ICombined3>();

                this.childScope = this.child.CreateScope();
            }
示例#3
0
 // Hijack constructor
 internal ProfessionalScope(ContainerScope scope)
     : base(scope)
 {
 }
 public ContainerScope CreateScope(ContainerScope parentScope = null)
 {
     return(new ContainerScope(parentScope));
 }
 public RequiresScopeAndDisposable(ContainerScope scope, Disposable disposable, RequiresScopeAndDisposable2 next)
 {
     Scope      = scope;
     Disposable = disposable;
     Next       = next;
 }
 public RequiresScopeAndDisposable3(ContainerScope scope, Disposable3 disposable)
 {
     Scope      = scope;
     Disposable = disposable;
 }
 public ThreadSafeContainerScope(ContainerScope parentScope = null)
     : base(parentScope)
 {
 }