/// <summary>
        /// 异步删除所有模型
        /// </summary>
        /// <param name="connectionId">连接ID</param>
        /// <returns>影响行数任务</returns>
        public virtual Task <int> DeleteAsync(ref string connectionId)
        {
            Task <int> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <int>(connId, isClose, dbConn, () =>
                {
                    return(Delete(dbConn));
                });
            });

            return(task);
        }
        /// <summary>
        /// 异步根据ID集合查询模型
        /// </summary>
        /// <param name="ids">ID集合</param>
        /// <param name="propertyNames">属性名称集合</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>模型任务</returns>
        public virtual Task <IList <ModelT> > SelectAsync(IdT[] ids, string[] propertyNames, ref string connectionId)
        {
            Task <IList <ModelT> > task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <IList <ModelT> >(connId, isClose, dbConn, () =>
                {
                    return(Select(ids, dbConn, propertyNames: propertyNames));
                });
            });

            return(task);
        }
        /// <summary>
        /// 异步插入模型列表
        /// </summary>
        /// <param name="models">模型列表</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>影响行数任务</returns>
        public virtual Task <int> InsertAsync(IList <ModelT> models, ref string connectionId)
        {
            Task <int> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <int>(connId, isClose, dbConn, () =>
                {
                    return(Insert(models, dbConn));
                });
            });

            return(task);
        }
        /// <summary>
        /// 异步根据ID更新模型
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="propertyNames">属性名称集合</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>影响行数任务</returns>
        public virtual Task <int> UpdateByIdAsync(ModelT model, string[] propertyNames, ref string connectionId)
        {
            Task <int> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <int>(connId, isClose, dbConn, () =>
                {
                    return(UpdateById(model, dbConn, propertyNames: propertyNames));
                });
            });

            return(task);
        }
        /// <summary>
        /// 异步查询模型列表并分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="propertyNames">属性名称集合</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="filter">筛选</param>
        /// <returns>分页信息任务</returns>
        public virtual Task <PagingInfo <ModelT> > SelectPageAsync(int pageIndex, int pageSize, string[] propertyNames, ref string connectionId, FilterInfo filter = null)
        {
            Task <PagingInfo <ModelT> > task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <PagingInfo <ModelT> >(connId, isClose, dbConn, () =>
                {
                    return(SelectPage(pageIndex, pageSize, dbConn, filter, propertyNames: propertyNames));
                });
            });

            return(task);
        }
        /// <summary>
        /// 异步根据ID查询模型
        /// </summary>
        /// <param name="id">ID</param>
        /// <param name="connectionId">连接ID</param>
        /// <returns>模型任务</returns>
        public virtual Task <ModelT> SelectAsync(IdT id, ref string connectionId)
        {
            Task <ModelT> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <ModelT>(connId, isClose, dbConn, () =>
                {
                    return(Select(id, dbConn));
                });
            });

            return(task);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 异步删除所有模型
        /// </summary>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>影响行数任务</returns>
        public virtual Task <int> DeleteAsync(ref string connectionId, CommonUseData comData = null)
        {
            Task <int> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <int>(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(Delete(dbConn, dbTransaction: dbTrans, comData: comData));
                });
            });

            return(task);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 异步根据ID集合查询模型
        /// </summary>
        /// <param name="ids">ID集合</param>
        /// <param name="propertyNames">属性名称集合</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>模型任务</returns>
        public virtual Task <IList <ModelT> > SelectAsync(IdT[] ids, string[] propertyNames, ref string connectionId, CommonUseData comData = null)
        {
            Task <IList <ModelT> > task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <IList <ModelT> >(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(Select(ids, dbConn, propertyNames: propertyNames, dbTransaction: dbTrans, comData: comData));
                }, AccessMode.SLAVE);
            }, accessMode: AccessMode.SLAVE);

            return(task);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 异步根据ID更新模型
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="propertyNames">属性名称集合</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>影响行数任务</returns>
        public virtual Task <int> UpdateByIdAsync(ModelT model, string[] propertyNames, ref string connectionId, CommonUseData comData = null)
        {
            Task <int> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <int>(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(UpdateById(model, dbConn, propertyNames: propertyNames, dbTransaction: dbTrans, comData: comData));
                });
            });

            return(task);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 异步根据ID查询模型
        /// </summary>
        /// <param name="id">ID</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>模型任务</returns>
        public virtual Task <ModelT> SelectAsync(IdT id, ref string connectionId, CommonUseData comData = null)
        {
            Task <ModelT> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <ModelT>(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(Select(id, dbConn, dbTrans, comData: comData));
                }, AccessMode.SLAVE);
            }, accessMode: AccessMode.SLAVE);

            return(task);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 异步根据ID和大于修改时间查询修改信息列表(多用于乐观锁的判断,以修改时间为判断)
        /// </summary>
        /// <param name="models">模型数组</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="mode">访问模式,默认为主库</param>
        /// <param name="comData">通用数据</param>
        /// <returns>只有修改信息的模型列表任务</returns>
        public virtual Task <IList <ModelT> > SelectModifyInfosByIdAndGeModifyTimeAsync(ModelT[] models, ref string connectionId, AccessMode mode = AccessMode.MASTER, CommonUseData comData = null)
        {
            Task <IList <ModelT> > task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <IList <ModelT> >(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(SelectModifyInfosByIdAndGeModifyTime(models: models, mode: mode, connectionId: connId));
                }, mode);
            }, accessMode: mode);

            return(task);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 异步查询模型列表并分页
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="propertyNames">属性名称集合</param>
        /// <param name="connectionId">连接ID</param>
        /// <param name="filter">筛选</param>
        /// <param name="comData">通用数据</param>
        /// <returns>分页信息任务</returns>
        public virtual Task <PagingInfo <ModelT> > SelectPageAsync(int pageIndex, int pageSize, string[] propertyNames, ref string connectionId, FilterInfo filter = null, CommonUseData comData = null)
        {
            Task <PagingInfo <ModelT> > task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <PagingInfo <ModelT> >(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(SelectPage(pageIndex, pageSize, dbConn, filter, propertyNames: propertyNames, dbTransaction: dbTrans, comData: comData));
                }, AccessMode.SLAVE);
            }, accessMode: AccessMode.SLAVE);

            return(task);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 异步统计模型数
        /// </summary>
        /// <param name="connectionId">连接ID</param>
        /// <param name="comData">通用数据</param>
        /// <returns>模型数任务</returns>
        public virtual Task <int> CountAsync(ref string connectionId, CommonUseData comData = null)
        {
            Task <int> task = null;

            DbConnectionManager.BrainpowerExecuteAsync(ref connectionId, this, (connId, isClose, dbConn) =>
            {
                task = ExecAsync <int>(connId, isClose, dbConn, (dbTrans) =>
                {
                    return(Count(dbConn, dbTransaction: dbTrans, comData: comData));
                }, AccessMode.SLAVE);
            }, accessMode: AccessMode.SLAVE);

            return(task);
        }