Example #1
0
        /// <summary>
        /// 如果与方法 BeginTransaction 匹配,则提交数据库事务。
        /// </summary>
        /// <returns>成功提交事务则为 true,否则为 false。</returns>
        public virtual bool CommitTransaction()
        {
            if (Transaction == null ||
                !tranStack.Pop())
            {
                return(false);
            }

            Transaction.Commit();
            Transaction.Dispose();
            Transaction = null;
            return(true);
        }
Example #2
0
        /// <summary>
        /// 如果与方法 BeginTransaction 匹配,则提交数据库事务。
        /// </summary>
        /// <returns>成功提交事务则为 true,否则为 false。</returns>
        public virtual bool CommitTransaction()
        {
            if (Transaction == null ||
                !tranStack.Pop())
            {
                return(false);
            }

#if !NET35 && !NET40
            if (taskMgr.HasTasks)
            {
                return(false);
            }
#endif

            Transaction.Commit();
            Transaction.Dispose();
            Transaction = null;
            return(true);
        }