public override Tendencia read(int id)
        {
            Tendencia dto = null;

            if (id > 0)
            {
                MySQL_DBManager db     = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Tendencia)));
                string          query  = "SELECT `Categoria_id`, `Patron_id`, `medida` FROM `tendencia` WHERE `id` = @identifier";
                Value           values = new Value();
                values.add("@identifier", id.ToString());
                MySqlDataReader reader = db.ExceuteSQL(query, values);
                if (reader != null)
                {
                    if (reader.Read())
                    {
                        dto = new Tendencia();
                        dto.setid(id);
                        if (!reader.IsDBNull(0))
                        {
                            dto.setCategoria_id(reader.GetInt32(0));
                        }
                        if (!reader.IsDBNull(1))
                        {
                            dto.setPatron_id(reader.GetInt32(1));
                        }
                        dto.setmedida(reader.GetInt32(2));
                    }
                    reader.Close();
                }
                db.close();
            }
            return(dto);
        }
 //Methods
 public override bool create(Tendencia dto)
 {
     if (dto != null && dto.isValid())
     {
         MySQL_DBManager db     = new MySQL_DBManager(DBCredentials_Factory.getCredentials(typeof(Tendencia)));
         string          query  = "INSERT INTO `tendencia` ( `id`, `Categoria_id`, `Patron_id`, `medida`) VALUES ( NULL, @Categoria_id, @Patron_id, @medida);";
         Value           values = new Value();
         values.add("@Categoria_id", dto.getCategoria_id().ToString());
         values.add("@Patron_id", dto.getPatron_id().ToString());
         values.add("@medida", dto.getmedida().ToString());
         if (db.ExecSQL(query, values))
         {
             dto.setid((int)db.getLastInsertedID());
             return(true);
         }
     }
     return(false);
 }