コード例 #1
0
 public PagedList <T> SqlQuery1 <T, S>(string sql, int pageIndex, Expression <Func <T, S> > orderBy, params object[] parms) where T : class
 {
     return(Database.SqlQuery <T>(sql, parms).AsQueryable().OrderBy(orderBy).ToPagedList(pageIndex, 15));
 }
コード例 #2
0
 /// <summary>
 /// 执行
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="proName"></param>
 /// <returns></returns>
 public List <T> ExecuteProcedure <T>(string proName)
 {
     return(Database.SqlQuery <T>(string.Format("EXEC {0}", proName)).ToList());
 }
コード例 #3
0
 /// <summary>
 /// sql查询数据
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="sql"></param>
 /// <param name="parms"></param>
 /// <returns></returns>
 public IQueryable <T> SqlQuery <T>(string sql, params object[] parms) where T : class
 {
     return(Database.SqlQuery <T>(sql, parms).AsQueryable());
 }
コード例 #4
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <param name="proName"></param>
        /// <returns></returns>
        public int ExecuteProcedure(string proName)
        {
            var res = Database.SqlQuery <int>(string.Format("EXEC {0}", proName)).ToList();

            return(res.FirstOrDefault());
        }