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)); }
/// <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()); }
/// <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()); }
/// <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()); }