Exemple #1
0
        /// <summary>
        /// 批量插入[基本方法]
        /// </summary>
        /// <param name="list"></param>
        /// <param name="keepIdentity">是否保持自增主键</param>
        public virtual void BatchInsert(List <TModel> list, bool keepIdentity = false)
        {
            AbsDBExtend db = DBExtend;

            db.BatchInsert(list, keepIdentity);
        }
Exemple #2
0
        /// <summary>
        /// 按条件取单个记录[基本方法]
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="idDest">是否按主键倒序</param>
        /// <param name="compileSp"></param>
        /// <returns></returns>
        public TModel QueryItem(Expression <Func <TModel, bool> > expression, bool idDest = true, bool compileSp = false)
        {
            AbsDBExtend db = DBExtend;

            return(db.QueryItem <TModel>(expression, idDest, compileSp));
        }
Exemple #3
0
        /// <summary>
        /// 取最小值[基本方法]
        /// </summary>
        /// <typeparam name="TType"></typeparam>
        /// <param name="expression"></param>
        /// <param name="field"></param>
        /// <param name="compileSp"></param>
        /// <returns></returns>
        public TType Min <TType>(Expression <Func <T, bool> > expression, Expression <Func <T, TType> > field, bool compileSp = false)
        {
            AbsDBExtend db = GetDBExtend();

            return(db.Min(expression, field, compileSp));
        }
Exemple #4
0
        /// <summary>
        /// 添加一条记录[基本方法]
        /// </summary>
        /// <param name="p"></param>
        public virtual void Add(TModel p)
        {
            AbsDBExtend db = DBExtend;

            db.InsertFromObj(p);
        }
Exemple #5
0
 public string CreateTable(AbsDBExtend db)
 {
     return(ModelCheck.CreateTable(GetType(), db));
 }
Exemple #6
0
        /// <summary>
        /// 统计[基本方法]
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="compileSp"></param>
        /// <returns></returns>
        public int Count(Expression <Func <T, bool> > expression, bool compileSp = false)
        {
            AbsDBExtend db = GetDBExtend();

            return(db.Count(expression, compileSp));
        }
Exemple #7
0
        /// <summary>
        /// 执行存储过程返回结果集
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="sp"></param>
        /// <returns></returns>
        protected List <T> RunList <T>(string sp) where T : class, new()
        {
            AbsDBExtend db = DBExtend;

            return(db.RunList <T>(sp));
        }
Exemple #8
0
        /// <summary>
        /// 取最大值[基本方法]
        /// </summary>
        /// <typeparam name="TType"></typeparam>
        /// <param name="expression"></param>
        /// <param name="field"></param>
        /// <param name="compileSp"></param>
        /// <returns></returns>
        public TType Max <TType>(Expression <Func <TModel, bool> > expression, Expression <Func <TModel, TType> > field, bool compileSp = false)
        {
            AbsDBExtend db = GetDBExtend();

            return(db.Max <TType, TModel>(expression, field, compileSp));
        }
Exemple #9
0
        /**
         * /// <summary>
         * /// 分页,并返回当前类型
         * /// 会按GROUP和自动编译判断
         * /// </summary>
         * /// <param name="query"></param>
         * /// <returns></returns>
         * public List<TModel> Page(CRL.LambdaQuery<TModel> query)
         * {
         *  DBExtend db = DBExtend;
         *  return db.Page<TModel, TModel>(query);
         * }
         * /// <summary>
         * /// 分页,并返回指定类型
         * /// 会按GROUP和自动编译判断
         * /// </summary>
         * /// <typeparam name="TResult"></typeparam>
         * /// <param name="query"></param>
         * /// <returns></returns>
         * public List<TResult> Page<TResult>(CRL.LambdaQuery<TModel> query) where TResult : class,new()
         * {
         *  DBExtend db = DBExtend;
         *  return db.Page<TModel, TResult>(query);
         * }
         *
         * /// <summary>
         * /// 返回动态类型分页
         * /// 会按GROUP和自动编译判断
         * /// </summary>
         * /// <param name="query"></param>
         * /// <returns></returns>
         * public List<dynamic> PageDynamic(CRL.LambdaQuery<TModel> query)
         * {
         *  DBExtend db = DBExtend;
         *  return db.Page(query);
         * }
         * */
        #endregion

        #region 更新
        /// <summary>
        /// 按对象差异更新,对象需由查询创建[基本方法]
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public int Update(TModel item)
        {
            AbsDBExtend db = DBExtend;

            return(db.Update(item));
        }
Exemple #10
0
        /// <summary>
        /// 指定条件查询[基本方法]
        /// </summary>
        /// <param name="expression"></param>
        /// <param name="compileSp"></param>
        /// <returns></returns>
        public List <TModel> QueryList(Expression <Func <TModel, bool> > expression, bool compileSp = false)
        {
            AbsDBExtend db = GetDBExtend();

            return(db.QueryList <TModel>(expression, compileSp));
        }
Exemple #11
0
        /// <summary>
        /// 返回全部结果[基本方法]
        /// </summary>
        /// <returns></returns>
        public List <TModel> QueryList()
        {
            AbsDBExtend db = GetDBExtend();

            return(db.QueryList <TModel>());
        }