コード例 #1
0
        public IServiceScope CreateScope()
        {
            var provider = new StKServiceProvider(this);
            var scope    = new StKServiceScope(provider);

            provider.ServiceScope = scope;
            return(scope);
        }
コード例 #2
0
        public IServiceProvider Build()
        {
            var provider = new StKServiceProvider(this);

            this.serviceProvider = provider;
            this.relations.Add(typeof(IServiceProvider), typeof(StKServiceProvider), ServiceLifetime.Singleton, instance: this.serviceProvider);
            this.relations.Add(typeof(IServiceScope), typeof(StKServiceScope), ServiceLifetime.Scoped);
            this.relations.Add(typeof(IServiceScopeFactory), typeof(StKServiceProvider), ServiceLifetime.Singleton, instance: this.serviceProvider);
            this.relations.Add(typeof(IStKProviderMonitor), typeof(StKObjectCollection), ServiceLifetime.Singleton, instance: provider.ObjectContainer);
            return(this.serviceProvider);
        }
コード例 #3
0
 public StKServiceProvider(StKServiceProvider serviceProvider)
 {
     this.serviceCollection = serviceProvider.serviceCollection;
     this.ObjectContainer   = serviceProvider.ObjectContainer;
 }