public virtual bool RemoveCacheStore(string name)
        {
            object cacheStoreObj;

            if (!CacheStores.TryRemove(name, out cacheStoreObj))
            {
                return(false);
            }

            IocManager.Release(cacheStoreObj);
            return(true);
        }
Exemplo n.º 2
0
 protected virtual void DisposeCaches()
 {
     foreach (var cache in Caches)
     {
         IocManager.Release(cache.Value);
     }
 }
 protected override void DisposeCaches()
 {
     foreach (var cache in Caches)
     {
         _iocManager.Release(cache.Value);
     }
 }
        private static void Test_Way_1(IIocManager iocManager)
        {
            var tester = iocManager.Resolve<Tester>();

            tester.Test();

            iocManager.Release(tester);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 释放工作单元中的 DbContext、事务。
        /// </summary>
        protected override void DisposeUnitOfWork()
        {
            _iocManager.Release(this);

            foreach (var activeDbContext in _activeDbContexts.Values)
            {
                activeDbContext.Dispose();
                _iocManager.Release(activeDbContext);
            }

            _activeDbContexts.Clear();

            if (_transactionScope != null)
            {
                _transactionScope.Dispose();
            }
        }
Exemplo n.º 6
0
        private static void Test_Way_1(IIocManager iocManager)
        {
            var tester = iocManager.Resolve <Tester>();

            tester.Test();

            iocManager.Release(tester);
        }
Exemplo n.º 7
0
 public void Release(IMessageHandler handler)
 {
     if (disposedValue)
     {
         throw new ObjectDisposedException(nameof(_iocManager));
     }
     _iocManager.Release(handler);
 }
Exemplo n.º 8
0
 public void Dispose()
 {
     foreach (var cache in Caches)
     {
         IocManager.Release(cache.Value);
     }
     Caches.Clear();
 }
Exemplo n.º 9
0
        public override void Dispose()
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (_transaction != null)
            {
                _transaction.Dispose();
                _transaction = null;
            }

            _activeDbContexts.Values.ForEach(dbContext =>
            {
                dbContext.Dispose();
                _iocManager.Release(dbContext);
            });

            _activeDbContexts.Clear();
        }
Exemplo n.º 10
0
 public override void ReleaseController(IController controller)
 {
     _iocManager.Release(controller);
 }
Exemplo n.º 11
0
 private void Release(IFileManagerServiceProvider service)
 {
     _iocManager.Release(service);
 }