Exemple #1
0
        /// <summary>
        /// 查询传输对象列表
        /// </summary>
        /// <typeparam name="TDto">传输对象类型</typeparam>
        /// <param name="condition">查询条件</param>
        /// <param name="ignoreFields">要忽略的字段</param>
        /// <param name="isWrite">是否为写连接(事务中使用)</param>
        /// <returns>传输对象列表</returns>
        public IEnumerable <TDto> QueryList <TDto>(object condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto>(condition, TableName, ignoreFields: ignoreFields, dbType: isWrite ? WriterDataType : ReaderDataType);

            return(GetDataAccess(isWrite: isWrite).Query <TDto>(query));
        }
Exemple #2
0
        /// <summary>
        /// 异步查询传输对象列表
        /// </summary>
        /// <typeparam name="TDto">传输对象类型</typeparam>
        /// <param name="condition">查询条件</param>
        /// <param name="ignoreFields">要忽略的字段</param>
        /// <param name="isWrite">是否为写连接(事务中使用)</param>
        /// <returns>传输对象列表</returns>
        public Task <IEnumerable <TDto> > QueryListAsync <TDto>(Expression <Func <T, bool> > condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto, T>(condition, TableName, ignoreFields: ignoreFields, dbType: isWrite ? WriterDataType : ReaderDataType);

            return(GetDataAccess(isWrite: isWrite).QueryAsync <TDto>(query));
        }
Exemple #3
0
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <param name="isWrite">是否为写连接(事务中使用)</param>
        /// <returns>列表</returns>
        public IEnumerable <T> QueryList(object condition, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery(condition, TableName, dbType: isWrite ? WriterDataType : ReaderDataType);

            return(GetDataAccess(isWrite: isWrite).Query <T>(query));
        }
Exemple #4
0
        /// <summary>
        /// 异步查询列表
        /// </summary>
        /// <param name="condition">查询条件</param>
        /// <param name="isWrite">是否为写连接(事务中使用)</param>
        /// <returns>列表</returns>
        public Task <IEnumerable <T> > QueryListAsync(Expression <Func <T, bool> > condition, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery(condition, TableName, dbType: isWrite ? WriterDataType : ReaderDataType);

            return(GetDataAccess(isWrite: isWrite).QueryAsync <T>(query));
        }
        public Task <IEnumerable <T> > QueryListAsync(bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <T>(null, TableName, string.Empty, topCount: null, dbType: WriterDataType);

            return(GetDataAccess(isWrite).QueryAsync <T>(query));
        }
        public Task <IEnumerable <TDto> > QueryListAsync <TDto>(object condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto>(condition, TableName, string.Empty, topCount: null, ignoreFields: ignoreFields, dbType: WriterDataType);

            return(GetDataAccess(isWrite).QueryAsync <TDto>(query));
        }
        public IEnumerable <TDto> QueryList <TDto>(Expression <Func <T, bool> > condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto>(condition, TableName, string.Empty, topCount: null, dbType: WriterDataType);

            return(GetDataAccess(isWrite).Query <TDto>(query));
        }
        public IEnumerable <T> QueryList(object condition, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <T>(condition, TableName, string.Empty, topCount: null, dbType: WriterDataType);

            return(GetDataAccess(isWrite).Query <T>(query));
        }
        /// <summary>
        /// 获取模型
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public Task <T> GetInfoAsync(Expression <Func <T, bool> > condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <T>(condition, TableName, string.Empty, topCount: null, ignoreFields: ignoreFields, dbType: WriterDataType);

            return(GetDataAccess().ExecuteScalarAsync <T>(query));
        }
        /// <summary>
        /// 获取模型
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public T GetInfo(object condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <T>(condition, TableName, string.Empty, topCount: null, ignoreFields: ignoreFields, dbType: WriterDataType);

            return(GetDataAccess().QuerySingleOrDefault <T>(query));
        }
        /// <summary>
        /// 获取DTO
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public TDto GetDto <TDto>(object condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto>(condition, TableName, string.Empty, topCount: null, ignoreFields: ignoreFields, dbType: WriterDataType);

            return(GetDataAccess().ExecuteScalar <TDto>(query));
        }