public static List <T> Run <T>(this SqlStrModel sqlStrModel, MSSqlDBContext db) { DbContextSqlQueryCommand dbContextSqlQueryCommand = new DbContextSqlQueryCommand(); dbContextSqlQueryCommand.QueryType = "text"; dbContextSqlQueryCommand.Query = sqlStrModel.SqlStr; return(SelectDb <T>(dbContextSqlQueryCommand, db)); }
public static T Run <T>(this GetByIdModel sqlStrModel, MSSqlDBContext db) { DbContextSqlQueryCommand dbContextSqlQueryCommand = new DbContextSqlQueryCommand(); dbContextSqlQueryCommand.QueryType = "text"; dbContextSqlQueryCommand.Query = sqlStrModel.IdStr; return(SelectDb <T>(dbContextSqlQueryCommand, db).FirstOrDefault()); //string sql = string.Empty; }
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); }
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)); }