I recently learned a little object orientation and c # . But I am trying to create an application that is developed in C # windows forms , with firebird and object-oriented database. But what is the right way to do it? How do I connect my bank to my application and how do I interact with the visual studio interface? I have also seen that it is possible to use App.Config
as in sql , but how do I do this?
For example, I currently have the repostory of a class and inside it I create events like add, change and etc, usually I do this:
public void Adicionar(Pais pais)
{
string sql = "INSERT INTO PAIS (PAINOME) VALUES('" + pais.PaiNome+ ")";
Conexao.Active(true);
FbCommand cmd = new FbCommand(sql, Conexao.fbCnn);
cmd.ExecuteNonQuery();
Conexao.Active(false);
}
This way every time I make some changes in the classes I have to change in all the repositories, for example, if I add a new field to the country I would have to change all the sql strings by adding the new field. Is this the right way to do it? Can I make it more automatic or not?
Thank you!