Exemplo n.º 1
0
        public static List <T> SelectDb <T>(DbContextSqlQueryCommand dbContextSqlQueryCommand, MSSqlDBContext db)
        {
            var DbRequest = DbContextExtensions.Query <T>(db, new DbContextSqlQueryCommands
            {
                Sql = dbContextSqlQueryCommand
            }).ToList();

            //string sql = string.Empty;
            return(DbRequest);
        }
Exemplo n.º 2
0
        public static List <T> Run <T>(this CheckInfo checkInfo, MSSqlDBContext db, List <ErrorList> erolt, ref int DataCount)
        {
            //select * from PaasOLT_OrderCarClean order by Id offset((2 - 1) * 20) rows fetch next 20 rows only;
            //查询
            string TsqlCountStr = "select COUNT(1) from " + checkInfo.tableName + " ";
            //条件
            string strWhere = checkInfo.strWhere == null ? null : " where " + checkInfo.strWhere;
            //查询总数
            DbContextSqlQueryCommand dbContextSqlQueryCommand = new DbContextSqlQueryCommand();

            dbContextSqlQueryCommand.QueryType = "text";
            dbContextSqlQueryCommand.Query     = TsqlCountStr + strWhere;
            int DbRequest = (int)DbContextExtensions.QueryObject(new MSSqlDBContext(), new DbContextSqlQueryCommands
            {
                Sql = dbContextSqlQueryCommand
            });

            DataCount = DbRequest;
            return(Run <T>(checkInfo, db, erolt));
        }