public List <TEntity> GetList <TEntity>(string connectionString, string sqlString) where TEntity : class, new() { List <TEntity> list = new List <TEntity>(); using (DataSet ds = DBHelperMySQL.Create(connectionString).Query(sqlString)) { if (ds == null) { return(list); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { list = ds.Tables[0].ConvertToList <TEntity>(); } } return(list); }
public TEntity GetEntityByProcedure <TEntity>(string connectionString, string procedureName, params MySqlParameter[] parameters) where TEntity : class, new() { TEntity entity = null; using (DataSet ds = DBHelperMySQL.Create(connectionString).RunProcedure(procedureName, parameters)) { if (ds == null) { return(entity); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { entity = ds.Tables[0].Rows[0].ConvertToModel <TEntity>(); } } return(entity); }
public List <TValue> GetValues <TValue>(string connectionString, string sqlString, params MySqlParameter[] parameters) { List <TValue> list = new List <TValue>(); using (DataSet ds = DBHelperMySQL.Create(connectionString).Query(sqlString, parameters)) { if (ds == null) { return(list); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { list = ds.Tables[0].ConvertToValues <TValue>(); } } return(list); }
public List <TEntity> GetListByProcedure <TEntity>(string connectionString, string procedureName, params MySqlParameter[] parameters) where TEntity : class, new() { List <TEntity> list = new List <TEntity>(); using (DataSet ds = DBHelperMySQL.Create(connectionString).RunProcedure(procedureName, parameters)) { if (ds == null) { return(list); } if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { list = ds.Tables[0].ConvertToList <TEntity>(); } } return(list); }