/// <summary>
        /// 删除数据
        /// </summary>
        /// <typeparam name="T">必须是可实例化的(IEntity)类型</typeparam>
        /// <param name="whereClip">删除的条件信息(必须有)</param>
        /// <param name="bDataBase">数据库名称(默认为当前数据库)</param>
        /// <param name="result">是否需要返回结果才继续执行,默认为true</param>
        /// <param name="tableFunc">替换表名称</param>
        public void DeleteTS <T>(WhereClip <T> whereClip, bool result, string bDataBase = ConstExpression.DataBase, Expression <Func <Type, string> > tableFunc = null) where T : class, IEntity
        {
            var dms = new DMS <T>(bDataBase, ConstExpression.WithLock, ConstExpression.NeedParams, ConstExpression.NeedQueryProvider).DMSDelete(whereClip);

            if (tableFunc != null)
            {
                dms.ReplaceTable(tableFunc);
            }
            string resultSql = dms.GetResultSql();

            if (resultSql.ToLower().IndexOf("where") == -1)
            {
                Log.Debug(ReflectionUtils.GetMethodBaseInfo(System.Reflection.MethodBase.GetCurrentMethod()), resultSql + "没有where条件,这是非常危险的操作", null);
                throw new DMSFrameException(resultSql + "没有where条件");
            }
            TransactionScopeEntity tEntity = new TransactionScopeEntity()
            {
                DataParameter = dms.dynamicParameters,
                ResultSql     = resultSql,
                ElementType   = typeof(T),
                ResultFlag    = result,
                ExcuteType    = DMSExcuteType.DELETE,
                EntityName    = typeof(T).FullName,
            };

            changeInternalDbProvider(typeof(T));
            TransactionScopeEntityList.Enqueue(tEntity);
        }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T0"></typeparam>
        /// <typeparam name="T1"></typeparam>
        /// <param name="entity"></param>
        /// <param name="whereFunc"></param>
        /// <param name="result"></param>
        /// <param name="aDataBase"></param>
        /// <param name="bDataBase"></param>
        public void EditTS <T0, T1>(Expression <Func <T1, T0> > entity, Expression <Func <T0, T1, bool> > whereFunc, bool result, string aDataBase = ConstExpression.DataBase, string bDataBase = ConstExpression.DataBase)
            where T0 : class, new()
            where T1 : class, new()
        {
            var    dms       = new DMS <T0, T1>(aDataBase, bDataBase, ConstExpression.WithLock, ConstExpression.NeedParams, ConstExpression.NeedQueryProvider).DMSEdit(entity, whereFunc);
            string resultSql = dms.GetResultSql();

            if (resultSql.ToLower().IndexOf("where") == -1)
            {
                Log.Debug(ReflectionUtils.GetMethodBaseInfo(System.Reflection.MethodBase.GetCurrentMethod()), resultSql + "没有where条件,这是非常危险的操作", null);
                throw new DMSFrameException(resultSql + "没有where条件");
            }
            TransactionScopeEntity tEntity = new TransactionScopeEntity()
            {
                DataParameter = dms.dynamicParameters,
                ResultSql     = resultSql,
                ElementType   = typeof(T0),
                ResultFlag    = result,
                ExcuteType    = DMSExcuteType.UPDATE_WHERE,
                EntityName    = typeof(T0).FullName,
            };

            changeInternalDbProvider(typeof(T0));
            TransactionScopeEntityList.Enqueue(tEntity);
        }
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TInsert"></typeparam>
        /// <typeparam name="TSelect"></typeparam>
        /// <param name="entity"></param>
        /// <param name="whereFunc"></param>
        /// <param name="result"></param>
        /// <param name="aDataBase"></param>
        /// <param name="bDataBase"></param>
        public void AddTS <TInsert, TSelect>(Expression <Func <TSelect, TInsert> > entity, Expression <Func <TSelect, bool> > whereFunc, bool result, string aDataBase = ConstExpression.DataBase, string bDataBase = ConstExpression.DataBase)
            where TInsert : class, new()
            where TSelect : class, new()
        {
            var    dms       = new DMS <TInsert, TSelect>(aDataBase, bDataBase, ConstExpression.WithLock, ConstExpression.NeedParams, ConstExpression.NeedQueryProvider).DMSInsertSelect(entity, whereFunc);
            string resultSql = dms.GetResultSql();
            TransactionScopeEntity tEntity = new TransactionScopeEntity()
            {
                DataParameter = dms.dynamicParameters,
                ResultSql     = resultSql,
                ElementType   = typeof(TInsert),
                ResultFlag    = result,
                ExcuteType    = DMSExcuteType.INSERT_SELECT,
                EntityName    = typeof(TInsert).FullName,
            };

            changeInternalDbProvider(typeof(TInsert));
            TransactionScopeEntityList.Enqueue(tEntity);
        }
        /// <summary>
        /// 新增一项数据
        /// </summary>
        /// <param name="entity">添加的实体参数</param>
        /// <param name="result">是否需要返回结果才继续执行,默认为true</param>
        /// <param name="bDataBase">数据库名称(默认为当前数据库)</param>
        /// <param name="tableFunc">替换表名称</param>
        public void AddTS <T>(T entity, bool result, string bDataBase = ConstExpression.DataBase, Expression <Func <Type, string> > tableFunc = null) where T : class, IEntity
        {
            DMS dms = DMS.Create(entity, entity.GetType(), bDataBase).DMSInsert(entity);

            if (tableFunc != null)
            {
                dms.TableExpressioin.ReplaceTable(tableFunc);
            }
            string resultSql = dms.GetResultSql();
            TransactionScopeEntity tEntity = new TransactionScopeEntity()
            {
                DataParameter = dms.dynamicParameters,
                ResultSql     = resultSql,
                ElementType   = entity.GetType(),
                ResultFlag    = result,
                ExcuteType    = DMSExcuteType.INSERT,
            };

            changeInternalDbProvider(entity.GetType());
            TransactionScopeEntityList.Enqueue(tEntity);
        }
        /// <summary>
        /// 编辑数据
        /// </summary>
        /// <typeparam name="T">必须是可实例化的(IEntity)类型</typeparam>
        /// <param name="entity">编辑的实体参数,必须有字段进行编辑过</param>
        /// <param name="bDataBase">数据库名称(默认为当前数据库)</param>
        /// <param name="whereFunc">编辑的条件信息</param>
        /// <param name="result">是否需要返回结果才继续执行,默认为true</param>
        /// <param name="tableFunc">替换表名称</param>
        public void EditTS <T>(T entity, Expression <Func <T, bool> > whereFunc, bool result, string bDataBase = ConstExpression.DataBase, Expression <Func <Type, string> > tableFunc = null) where T : class, IEntity
        {
            T   value = Activator.CreateInstance(typeof(T)) as T;
            var dms   = new DMS <T>(bDataBase, ConstExpression.WithLock, ConstExpression.NeedParams, ConstExpression.NeedQueryProvider).DMSEdit <T>(entity, whereFunc);

            if (tableFunc != null)
            {
                dms.ReplaceTable(tableFunc);
            }
            string resultSql = dms.GetResultSql();
            TransactionScopeEntity tEntity = new TransactionScopeEntity()
            {
                DataParameter = dms.dynamicParameters,
                ResultSql     = resultSql,
                ElementType   = entity.GetType(),
                ResultFlag    = result,
                ExcuteType    = DMSExcuteType.UPDATE,
            };

            changeInternalDbProvider(typeof(T));
            TransactionScopeEntityList.Enqueue(tEntity);
        }