Exemple #1
0
        protected override void DisposeUow()
        {
            if (Options.IsTransactional == true)
            {
                _transactionStrategy.Dispose(IocResolver);
            }
            else
            {
                foreach (var activeDbContext in GetAllActiveDbContexts())
                {
                    Release(activeDbContext);
                }
            }

            ActiveDbContexts.Clear();
        }
Exemple #2
0
        /// <summary>
        /// uow完成后自动释放
        /// </summary>
        protected override void DisposeUow()
        {
            //DbContext.Dispose();

            if (null == Options)
            {
                return;
            }

            if (Options.IsTransactional == true)
            {
                foreach (var dbContext in DbContexts)
                {
                    IocResolver.Release(dbContext);
                }

                DbContexts.Clear();

                if (CurrentTransaction != null)
                {
                    CurrentTransaction.Dispose();
                    CurrentTransaction = null;
                }
            }
            else
            {
                foreach (var activeDbContext in ActiveDbContexts.Values.ToImmutableList())
                {
                    Release(activeDbContext);
                }
            }

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

            ActiveDbContexts.Clear();
        }
Exemple #3
0
 protected override void DisposeUnit()
 {
     _efTransactionStrategy.Dispose(IocResolve);
     ActiveDbContexts.Clear();
 }